Skip Menu |
 

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the DBD-Oracle CPAN distribution.

Report information
The Basics
Id: 46016
Status: resolved
Priority: 0/
Queue: DBD-Oracle

People
Owner: champoux [...] pythian.com
Requestors: rkitover@cpan.org (no email address)
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.23
Fixed in:
  • 1.24
  • 1.24a
  • 1.24b



Subject: LOBs bound with ora_field broken
Attached patch with fix and failing test. -- Rafael
Subject: dbd-ora-lob.patch
Download dbd-ora-lob.patch
text/x-diff 1.6k
diff --git a/oci8.c b/oci8.c index 675b795..94365ab 100644 --- a/oci8.c +++ b/oci8.c @@ -3675,6 +3675,7 @@ init_lob_refetch(SV *sth, imp_sth_t *imp_sth) "Need bind_param(..., { ora_field=>... }) attribute to identify table LOB field names"); } } + } matched = 1; sprintf(sql_field, "%s%s \"%s\"", (SvCUR(sql_select)>7)?", ":"", p, &phs->name[1]); @@ -3693,7 +3694,6 @@ init_lob_refetch(SV *sth, imp_sth_t *imp_sth) fbh->desc_t = OCI_DTYPE_LOB; OCIDescriptorAlloc_ok(imp_sth->envhp, &fbh->desc_h, fbh->desc_t); break; /* we're done with this placeholder now */ - } } if (!matched) { ++unmatched_params; diff --git a/t/31lob.t b/t/31lob.t index e2a9b7e..bfdc6c9 100644 --- a/t/31lob.t +++ b/t/31lob.t @@ -1,7 +1,7 @@ #!/usr/bin/perl use strict; -use Test::More tests => 9; +use Test::More tests => 11; use DBD::Oracle qw(:ora_types); use DBI; @@ -38,6 +38,19 @@ $sth->execute; ($loc) = $sth->fetchrow; is (ref $loc, "OCILobLocatorPtr", "returned valid locator"); +## test inserting a large value +$stmt = "INSERT INTO $table (id,data) VALUES (666, ?)"; +$sth = $dbh->prepare($stmt); +my $content = join(q{}, map { chr } ( 32 .. 64 )) x 16384; +$sth->bind_param(1, $content, { ora_type => ORA_BLOB, ora_field => 'data' }); +eval { $sth->execute($content) }; +is $@, '', 'inserted into BLOB successfully'; +{ + local $dbh->{LongReadLen} = 1_000_000; + my ($fetched) = $dbh->selectrow_array("select data from $table where id = 666"); + is $fetched, $content, 'got back what we put in'; +} + ## test with insert empty blob returning blob to a var. ($id, $loc) = (2, undef); $stmt = "INSERT INTO $table (id,data) VALUES (?, EMPTY_BLOB()) RETURNING data INTO ?";
Download (untitled) / with headers
text/plain 188b
Ok I have applied the patch seem to pass all the tests and the new one as well The code has been checked into Trunk ans you can find it at http://svn.perl.org/modules/dbd-oracle/trunk


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.