Author: byterock
Date: Fri Apr 23 06:25:18 2010
New Revision: 13923

Modified:
   dbd-oracle/trunk/Changes
   dbd-oracle/trunk/oci8.c
   dbd-oracle/trunk/t/55nested.t

Log:
Fix for rt.cpan.org Ticket #=56810 bug with multiple nested cursor from John 
Scoles 
  Seems you can fetch only one row at a time with nested cursor also expanded 
test 55 to test for 1 plus cursor

Modified: dbd-oracle/trunk/Changes
==============================================================================
--- dbd-oracle/trunk/Changes    (original)
+++ dbd-oracle/trunk/Changes    Fri Apr 23 06:25:18 2010
@@ -1,4 +1,10 @@
+=head1 Changes in DBD-Oracle 1.25(svn rev #####)
+
+  Fix for rt.cpan.org Ticket #=56810 bug with multiple nested cursor from John 
Scoles 
+  Fix for Patch bug found only on Big-Endian hardware reported by Timothy 
Everett and others from Charles Jardine 
+
 =head1 Changes in DBD-Oracle 1.24(svn rev 13793)
+
   Extended precision for OCIDateTimeToText to 6 instead of 0 for embedded 
types from John Scoles
   Extended support of Oracle Embedded objects from Charles Jardine
   Added support for RowsInCache as RO and RowCacheSize as a set-able value on 
the Statement Handle. So it would comply with DBI spec By John Scoles with 
thanks to Martin J. Evans 
@@ -22,6 +28,7 @@
   Fix for bug in 58object.t when test run as externally identified user from 
Charles Jardine
 
 =head1 Changes in DBD-Oracle 1.23(svn rev 12724)
+
   Fix from rt.cpan.org ticket #=44788 bool in_lite should be char in_literal 
   Fix for UTF8 and blobs by John Scoles with Milo van der Leij
   Fix for some warnings and one bug in ocitrace.h from Charles Jardine
@@ -48,6 +55,7 @@
   
   
 =head1 Changes in DBD-Oracle 1.22(svn rev 11618)  1st Aug 2008 
+
   Patch to remove compiler warnings from H.Merijn Brand
   Patch to Makfile for 64bit boxes from Alex Laslavic
   Added OCILobGetLength to lob functions from Milo van der Leij

Modified: dbd-oracle/trunk/oci8.c
==============================================================================
--- dbd-oracle/trunk/oci8.c     (original)
+++ dbd-oracle/trunk/oci8.c     Fri Apr 23 06:25:18 2010
@@ -2661,19 +2661,10 @@
 void rs_array_init(imp_sth_t *imp_sth)
 {
        dTHX;
-/*     if (imp_sth->rs_array_on!=1             ||
-               imp_sth->rs_array_size<1        ||
-               imp_sth->rs_array_size>128){
 
-               imp_sth->rs_array_on=0;
-               imp_sth->rs_array_size=1;
-
-       }*/
        imp_sth->rs_array_num_rows      =0;
        imp_sth->rs_array_idx           =0;
        imp_sth->rs_fetch_count         =0;
-       /*imp_sth->prefetch_rows                =0;
-       imp_sth->prefetch_memory        =0;*/
        imp_sth->rs_array_status        =OCI_SUCCESS;
 
        if (DBIS->debug >= 3 || dbd_verbose >= 3 )
@@ -2681,19 +2672,6 @@
 }
 
 
-
-
-
-
-
-
-
-
-
-
-
-
-
 static int                     /* --- Setup the row cache for this sth --- */
 sth_set_row_cache(SV *h, imp_sth_t *imp_sth, int max_cache_rows, int 
num_fields, int has_longs)
 {
@@ -2801,8 +2779,8 @@
 
        imp_sth->rs_array_size=cache_rows;
 
-    if (max_cache_rows){/* limited by a cursor or something else*/
-               imp_sth->rs_array_size=max_cache_rows;
+    if (max_cache_rows){/* limited to 1 by a cursor or something else*/
+               imp_sth->rs_array_size=1;
        }
 
 

Modified: dbd-oracle/trunk/t/55nested.t
==============================================================================
--- dbd-oracle/trunk/t/55nested.t       (original)
+++ dbd-oracle/trunk/t/55nested.t       Fri Apr 23 06:25:18 2010
@@ -15,7 +15,7 @@
 my $dbh = DBI->connect($dsn, $dbuser, '', { PrintError => 0 });
 
 if ($dbh) {
-    plan tests=> 16;
+    plan tests=> 29;
 } else {
     plan skip_all =>"Unable to connect to Oracle as $dbuser ($DBI::errstr)\n";
 }
@@ -48,6 +48,34 @@
 ok($outer->finish, 'outer finish');
 is($dbh->{ActiveKids}, 0, 'ActiveKids');
 
+#########################################################################
+# Same test again but this time with 2 cursors
+#########################################################################
+
+$outer = $dbh->prepare(q{
+    SELECT object_name, 
+           CURSOR(SELECT object_name FROM dual),
+           CURSOR(SELECT object_name FROM dual)
+      FROM all_objects WHERE rownum <= 5});
+ok($outer, 'prepare select');
+
+ok( $outer->{ora_types}[1] == ORA_RSET, 'set ORA_RSET');
+ok( $outer->{ora_types}[2] == ORA_RSET, 'set ORA_RSET');
+ok( $outer->execute, 'outer execute');
+ok(  @row1 = $outer->fetchrow_array, 'outer fetchrow');
+$inner1 = $row1[1];
+my $inner2 = $row1[2];
+is( ref $inner1, 'DBI::st', 'inner DBI::st');
+is( ref $inner2, 'DBI::st', 'inner DBI::st');
+
+ok( $inner1->{Active}, 'inner Active');
+ok( $inner2->{Active}, 'inner Active');
+ok( @row1_1 = $inner1->fetchrow_array, 'inner fetchrow_array');
+ok( my @row2_1 = $inner2->fetchrow_array, 'inner fetchrow_array');
+is( $row1[0], $row1_1[0], 'rows equal');
+is( $row1[0], $row2_1[0], 'rows equal');
+
+
 
 #########################################################################
 # Fetch speed test: START

Reply via email to