Subject: | 31lob_extended.t: SYS_REFCURSOR not defined |
In old old Oracle8, SYS_REFCURSOR is not defined.
Instead of CREATE/DROP PROCEDURE, I'd use an anonymous
block - see attached patch.
This works in Oracle8 and the tests pass.
Now, we support more versions with less code - what more
could you ask for?
Subject: | 31lob_extended.diff |
Index: t/31lob_extended.t
===================================================================
--- t/31lob_extended.t (revision 15459)
+++ t/31lob_extended.t (working copy)
@@ -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")