OCIRollBack() doesnt work
| From: | omar cromwell mercado | Date: | Thu, 26 Oct 2000 04:40:03 +0000 |
| Subject: | OCIRollBack() doesnt work | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-3920@lists.php.net to get a copy of this message | ||
Hi,
I wonder why ocirollback() wont work in my case,
though
it does work in sqlplus using same account. My php is
compiled with --with-oci and --with-oracle. Below is
my code. I appreciate if someone can point me the
right
way of using ocirollback() if my code is incorrect.
Thanks a lot. I appreciate any comments.
<?php
$conn = ocilogon("robo","banner","");
print $conn;
$query="select username from test";
$cur=OCIParse($conn, $query);
OCIExecute($cur);
$data=array();
while (OCIFetchInto($cur, &$data))
print "$data[0]<br>";
// output is 'test1'
// now, i want to update it to test2
$query="update test set username='test2'";
$cur=OCIParse($conn, $query);
OCIExecute($cur);
// i'll check if it has changed
$query="select username from test";
$cur=OCIParse($conn, $query);
OCIExecute($cur);
while (OCIFetchInto($cur, &$data))
print "After the update: $data[0]<br>";
// it displays test2 as expected
// now, i want to roll it back to previous value
ocirollback($conn);
// ill running 'select' again to find out
$query="select username from test";
$cur=OCIParse($conn, $query);
OCIExecute($cur);
$data=array();
while (OCIFetchInto($cur, &$data))
print "After the rollback: $data[0]<br>";
// output is still 'test2'! didnt rollback to value
// before the update. what am i doing wrong?
?>
__________________________________________________
Do You Yahoo!?
Yahoo! Messenger - Talk while you surf! It's FREE.
http://im.yahoo.com/