note 38927 deleted from ref.oracle by danbrown
| From: | danbrown@php.net | Date: | Fri, 28 Nov 2008 22:25:02 +0000 |
| Subject: | note 38927 deleted from ref.oracle by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-147327@lists.php.net to get a copy of this message | ||
Note Submitter: php kosmisk dk (punctuation needed)
----
To make sure my oracle get's rolledback when my script once in a while dies or I make a mistake
(statements are terminated with ";"...). I use this construction. Because if it isn't
rolled back and you use plogon, other oracle connections might hang, until the apache process that
ran the failed script is terminated, and therefore releases the connection and gives the implicit
rollback.
The use of a shutdown_function:
$oracle = ora_plogon("user/pass@db", "") or die("Can't connect to
db");
$cursor = ora_open($oracle);
ora_commitoff($oracle);
function ora_shutdown() {
global $oracle;
global $cursor;
ora_rollback($oracle);
ora_close($cursor);
ora_logoff($oracle);
}
register_shutdown_function(ora_shutdown);