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: 46246
Status: resolved
Priority: 0/
Queue: DBD-Oracle

People
Owner: champoux [...] pythian.com
Requestors: tomas.zemres [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 1.23
Fixed in:
  • 1.24
  • 1.24a
  • 1.24b



Subject: fetching from nested cursor (returned from procedure) leads to application crash (abort)
I make simple testing code "dbdbugtest.pl" (attached) This script works fine with DBD::Oracle 1.22, but with version 1.23 script crashes (on fetch row from nested cursor) with exit code 134 "Aborting"
Subject: dbdbugtest.pl
#!/usr/bin/env perl use strict; use warnings; use DBI; use DBD::Oracle 1.23; my $dbh = DBI->connect("dbi:Oracle:dprod.netsafe.cz", "tnt", "welcome1", { AutoCommit => 0, RaiseError => 1, PrintError => 1, ora_verbose => 0 } ); eval { $dbh->do("DROP TABLE test_tb1"); }; eval { $dbh->do("DROP TABLE test_tb2"); }; $dbh->do("CREATE TABLE test_tb1 ( id INTEGER, name VARCHAR2(10))") or die $dbh->errstr; $dbh->do("CREATE TABLE test_tb2 ( id INTEGER, item VARCHAR2(10))") or die $dbh->errstr; for (my $i = 1; $i < 3; $i++) { $dbh->do("INSERT INTO test_tb1 VALUES ('$i', 'name$i')") or die $dbh->errstr; for (my $n = 1; $n < 3; $n++) { $dbh->do("INSERT INTO test_tb2 VALUES ('$i', 'item$i')") or die $dbh->errstr; } } my $sth = $dbh->prepare("SELECT id, name, CURSOR(SELECT * FROM test_tb2 t2 WHERE t1.id = t2.id) FROM test_tb1 t1"); $sth->execute(); while (my @row = $sth->fetchrow_array()) { print "ROW: @row\n"; while (my @item = $row[2]->fetchrow_array()) { print " item: @item\n"; } } $dbh->rollback();
Sorry, I sent wrong file. This is correct file. Problem is in nested cursors returned from pl/sql procedure.
#!/usr/bin/env perl use strict; use warnings; use DBI; use DBD::Oracle 1.23 qw(:ora_types); my $dbh = DBI->connect("dbi:Oracle:dprod.netsafe.cz", "tnt", "welcome1", { AutoCommit => 0, RaiseError => 1, PrintError => 1, ora_verbose => 0 } ); eval { $dbh->do("DROP TABLE test_tb1"); }; eval { $dbh->do("DROP TABLE test_tb2"); }; $dbh->do("CREATE TABLE test_tb1 ( id INTEGER, name VARCHAR2(10))") or die $dbh->errstr; $dbh->do("CREATE TABLE test_tb2 ( id INTEGER, item VARCHAR2(10))") or die $dbh->errstr; for (my $i = 1; $i < 3; $i++) { $dbh->do("INSERT INTO test_tb1 VALUES ('$i', 'name$i')") or die $dbh->errstr; for (my $n = 1; $n < 3; $n++) { $dbh->do("INSERT INTO test_tb2 VALUES ('$i', 'item$i')") or die $dbh->errstr; } } $dbh->do("CREATE OR REPLACE PROCEDURE test_getData(c OUT SYS_REFCURSOR) IS BEGIN OPEN c FOR SELECT id, name, CURSOR(SELECT * FROM test_tb2 t2 WHERE t1.id = t2.id) FROM test_tb1 t1; END; ") or die $dbh->errstr; my $sth = $dbh->prepare("BEGIN test_getData(:c); END;\n"); my $cur; $sth->bind_param_inout(':c', \$cur, 4000, { ora_type => ORA_RSET } ) or die $sth->errstr; $sth->execute(); while (my @row = $cur->fetchrow_array()) { print "ROW: @row\n"; while (my @item = $row[2]->fetchrow_array()) { print " item: @item\n"; } } $dbh->rollback();
Ok I have found the problem of course it is only a two char fix in oci8.c was 2296 if (imp_sth->is_child && imp_sth->ret_lobs){ /*ref cursors and sp only one row is allowed*/ change to 2296 if (imp_sth->is_child || imp_sth->ret_lobs){ /*ref cursors and sp only one row is allowed*/ I have checked this into trunk which you can get at http://svn.perl.org/modules/dbd-oracle/trunk cheers John S