Re: RE: pdo design

From: Date: Sun, 23 May 2004 01:28:27 +0000
Subject: Re: RE: pdo design
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-10042@lists.php.net to get a copy of this message
George Schlossnagle wrote:
On May 22, 2004, at 9:12 PM, Alan Knowles wrote:
Just a thought - feel free to ignore... In dataobjects rather than implement extra methods for transactions, I just hooked into query .. eg. $do->query('BEGIN') - turned off autocommit, and ran begin. $do->query('ROLLBACK') or $do->('COMMIT'); - ranit , then turned autocommit back on It seemed far more sensible than fattening up the API.
The problem is that those have different syntaxes in different rdbms systems.
thats why it hooks into the query (or exec method, and re-writes it).. In dataobjects it something like this. function query($str) { if ($str == 'BEGIN') {
         $db->begin(); ... this deals with the different syntaxes..
         return;
    }
    $db->query($str);
} Regards Alan
George


« previous php.internals (#10042) next »