[svn:dbd-oracle] r15462 - in dbd-oracle/trunk: . t

[email protected] Tue, 30 Oct 2012 06:17:25 -0700 (PDT)
Newsgroups perl.dbd.oracle.changes
Message-ID <[email protected]>
Author: mjevans
Date: Tue Oct 30 06:17:25 2012
New Revision: 15462

Modified:
   dbd-oracle/trunk/Changes
   dbd-oracle/trunk/t/31lob_extended.t

Log:
Improved 31lob_extended.t which supports Oracle 8.


Modified: dbd-oracle/trunk/Changes
==============================================================================
--- dbd-oracle/trunk/Changes	(original)
+++ dbd-oracle/trunk/Changes	Tue Oct 30 06:17:25 2012
@@ -16,6 +16,10 @@
   - Fix RT80487. Skip XMLType tests if Oracle less than V9. Thanks to
     Steffen Goeldner.
 
+  - Fix RT80486 for 31lob_extended.t. In old old Oracle8,
+    SYS_REFCURSOR is not defined. Instead of CREATE/DROP PROCEDURE,
+    use anonymous block. Thanks to Steffen Goeldner.
+
   [MISCELLANEOUS]
 
   - The original 26exe_array test was replaced some time ago with a

Modified: dbd-oracle/trunk/t/31lob_extended.t
==============================================================================
--- dbd-oracle/trunk/t/31lob_extended.t	(original)
+++ dbd-oracle/trunk/t/31lob_extended.t	Tue Oct 30 06:17:25 2012
@@ -30,7 +30,7 @@
                        });
 
 if ($dbh) {
-    plan tests => 31;
+    plan tests => 30;
     $dbh->{LongReadLen} = 7000;
 } else {
     plan skip_all => "Unable to connect to Oracle";
@@ -39,6 +39,14 @@
 
 my ($table, $data0, $data1) = setup_test($dbh);
 
+my $PLSQL = <<"PLSQL";
+BEGIN
+  OPEN ? FOR SELECT x FROM $table;
+END;
+PLSQL
+
+$dbh->{RaiseError} = 1;
+
 #
 # bug in DBD::Oracle 1.21 where if ora_auto_lobs is not set and we attempt to
 # fetch from a table containing lobs which has more than one row
@@ -49,9 +57,7 @@
 
     my ($sth1, $ev);
 
-    eval {$sth1 = $dbh->prepare(
-        q/begin p_DBD_Oracle_drop_me(?); end;/, {ora_auto_lob => 0});
-      };
+    eval {$sth1 = $dbh->prepare($PLSQL, {ora_auto_lob => 0});};
     ok(!$@, "$testname - prepare call proc");
     my $sth2;
     ok($sth1->bind_param_inout(1, \$sth2, 500, {ora_type => ORA_RSET}),
@@ -80,10 +86,8 @@
 
     my ($sth1, $ev, $lob);
 
-    eval {$sth1 = $dbh->prepare(
-        # ora_auto_lobs is supposed to default to set
-        q/begin p_DBD_Oracle_drop_me(?); end;/);
-      };
+    # ora_auto_lobs is supposed to default to set
+    eval {$sth1 = $dbh->prepare($PLSQL);};
     ok(!$@, "$testname prepare call proc");
     my $sth2;
     ok($sth1->bind_param_inout(1, \$sth2, 500, {ora_type => ORA_RSET}),
@@ -153,20 +157,6 @@
     BAIL_OUT("Failed to insert test data into $table - $@") if $@;
     ok(!$ev, "created test data");
 
-    my $createproc = << "EOT";
-CREATE OR REPLACE PROCEDURE p_DBD_Oracle_drop_me(pc OUT SYS_REFCURSOR) AS
-l_cursor SYS_REFCURSOR;
-BEGIN
-OPEN l_cursor FOR
-  SELECT x from $table;
-pc := l_cursor;
-END;
-EOT
-
-    eval {$h->do($createproc);};
-    BAIL_OUT("Failed to create test procedure - $@") if $@;
-    ok(!$ev, "created test procedure");
-
     return ($table, $data0, $data1);
 }
 
@@ -176,12 +166,6 @@
     local $dbh->{PrintError} = 0;
     local $dbh->{RaiseError} = 1;
 
-    eval {$dbh->do(q/drop procedure p_DBD_Oracle_drop_me/);};
-    if ($@) {
-        diag("procedure p_DBD_Oracle_drop_me possibly not dropped" .
-                    "- check - $@\n") if $dbh->err ne '4043';
-    }
-
     eval {drop_table($dbh);};
     if ($@) {
         diag("table $table possibly not dropped - check - $@\n")