[svn:dbd-oracle] r15589 - dbd-oracle/trunk/t
[email protected] Mon, 25 Mar 2013 13:08:14 -0700 (PDT)
| Newsgroups | perl.dbd.oracle.changes |
|---|---|
| Message-ID | <[email protected]> |
Author: mjevans
Date: Mon Mar 25 13:08:13 2013
New Revision: 15589
Modified:
dbd-oracle/trunk/t/51scroll.t
Log:
Add test for rt 84170 - fethc off the end of the result-set
NOTE: will fail until the patch in rt 84170 is applied
simplifiy a few for loops
Modified: dbd-oracle/trunk/t/51scroll.t
==============================================================================
--- dbd-oracle/trunk/t/51scroll.t (original)
+++ dbd-oracle/trunk/t/51scroll.t Mon Mar 25 13:08:13 2013
@@ -26,7 +26,7 @@
if ($dbh) {
plan skip_all => "Scrollable cursors new in Oracle 9"
if $dbh->func('ora_server_version')->[0] < 9;
- plan tests => 36;
+ plan tests => 37;
} else {
plan skip_all => "Unable to connect to Oracle";
}
@@ -50,25 +50,26 @@
$sth =$dbh-> prepare($sql);
-for ($i=1;$i<=10;$i++){
- $sth-> bind_param(1, $i);
- $sth->execute();
-}
+$sth->execute($_) foreach (1..10);
$sql="select * from ".$table;
-ok($sth=$dbh->prepare($sql,{ora_exe_mode=>OCI_STMT_SCROLLABLE_READONLY,ora_prefetch_memory=>200}));
+ok($sth=$dbh->prepare($sql,
+ {ora_exe_mode=>OCI_STMT_SCROLLABLE_READONLY,
+ ora_prefetch_memory=>200}));
ok ($sth->execute());
#first loop all the way forward with OCI_FETCH_NEXT
-for($i=1;$i<=10;$i++){
+foreach (1..10) {
$value = $sth->ora_fetch_scroll(OCI_FETCH_NEXT,0);
- cmp_ok($value->[0], '==', $i, '... we should get the next record');
+ is($value->[0], $_, '... we should get the next record');
}
-
-
$value = $sth->ora_fetch_scroll(OCI_FETCH_CURRENT,0);
cmp_ok($value->[0], '==', 10, '... we should get the 10th record');
+# fetch off the end of the result-set
+$value = $sth->ora_fetch_scroll(OCI_FETCH_NEXT, 0);
+is($value, undef, "end of result-set");
+
#now loop all the way back
for($i=1;$i<=9;$i++){
$value = $sth->ora_fetch_scroll(OCI_FETCH_PRIOR,0);