MDB & Transactions
| From: | Sonny | Date: | Sun, 14 Sep 2003 20:28:25 +0000 |
| Subject: | MDB & Transactions | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-7803@lists.php.net to get a copy of this message | ||
Hello,
how it is possible to use Transaction capabilitys with MDB?
Or am I wrong to use it with mySQL ( INNODB )?
I try it the following:
Config:
$database['type'] = "mysql";
$database['host'] = "localhost";
$database['name'] = "eXXXXXX";
$database['user'] = "XXXXXX";
$database['pass'] = "XXXXXX";
$database['dsn'] =
$database['type']."://".$database['user'].":".$database['pass']."@".$databas
e['host']."/".$database['name'];
$database['options']['persistent'] = 0;
$database['options']['autocommit'] = 0;
$database['options']['debug'] = 9;
$database['options']['UseTransactions'] = 1;
$database['options']['autofree'] = 1;
Connect:
$my &= MDB::connect( $database[dsn], $database[options] );
If I then do an print_r($my) ad take a look at the options!
[options] => Array
(
[persistent] => 0
[debug] =>
[autofree] =>
[lob_buffer_length] => 8000
[log_line_break] =>
[seqname_format] => %s_seq
[includelob] =>
[includemanager] =>
[UseTransactions] =>
[DefaultTableType] =>
[fixed_float] =>
)
So if I'm right the Transaction stuff and so on are not active?
So I try an little test which fails!
$q = $my->prepareQuery("BEGIN");
$my->execute($q);
$q2 = $my->prepareQuery("insert into test(id,logdate)
VALUES('".$my->nextID('test')."',NOW() )");
$my->execute($q);
print_r( $my->getOne("Select count(id) from test") );
$my->commit();
Bummer both time the print gives me an 0. But I expect to have 01.
No error messages come back. So I don't know why it does not work?
Any hints for me?
Cheers
-Peter