Re: Comments on this patch for dbms_output_get() ?
John Scoles <[email protected]>
| Newsgroups | gmane.comp.lang.perl.modules.dbi.sybase.devel |
|---|---|
| Message-ID | <[email protected]> |
simple enough I will put it in the 1.25 release
> I created this patch because of this issue (which we have run into),
>
> ==========================================================================
> Parameter Description
> line Returns a single line of buffered information,
> excluding a final newline character. You should
> declare the actual for this parameter as VARCHAR2 (32767)
> to avoid the risk of "ORA-06502: PL/SQL: numeric or value error:
> character string buffer too small".
>
> status If the call completes successfully, then the status returns as 0.
> If there are no more lines in the buffer, then the status is 1.
>
> ==========================================================================
>
> --- Oracle.pm.orig 2010-03-31 15:27:16.000000000 -0500
> +++ Oracle.pm 2010-03-31 16:09:37.000000000 -0500
> @@ -766,8 +766,11 @@
> my $sth = $dbh->prepare_cached("begin
> dbms_output.get_line(:l, :s); end;")
> or return;
> my ($line, $status, @lines);
> + my $version = join ".", @{ ora_server_version($dbh) }[0..1];
> + my $len = $version >= 10.2 ? 32767 : 400;
> +
> # line can be greater that 255 (e.g. 7 byte date is expanded on
> output)
> - $sth->bind_param_inout(':l', \$line, 400, { ora_type => 1 });
> + $sth->bind_param_inout(':l', \$line, $len, { ora_type => 1 });
> $sth->bind_param_inout(':s', \$status, 20, { ora_type => 1 });
> if (!wantarray) {
> $sth->execute or return undef;
>
>
> Thanks,
> Scott
>