Re: MDB2 transaction misconfiguration with mysql
| From: | fusillo | Date: | Thu, 06 Sep 2007 13:04:21 +0000 |
| Subject: | Re: MDB2 transaction misconfiguration with mysql | ||
| References: | 1 2 3 4 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-27879@lists.php.net to get a copy of this message | ||
Lukas Kahwe Smith ha scritto:
Here is the code in the driver:
$this->supported['transactions'] = $this->options['use_transactions'];
if ($this->options['default_table_type']) {
switch (strtoupper($this->options['default_table_type'])) {
[cut]
}
}
confused.. the code seems correct as the empty string might match false in php, then the switch might be never run and $this->supported['transactions'] get the value of use_transactions setting, because in my code there is: $mdb2=&MDB2::singleton($dsn,array('use_transactions'=>true));
no change if i set the default_table_type option to InnoDB:
New code:
require_once 'MDB2.php';
$dsn=array('phptype'=>'mysql','username'=>'fake','password'=>'fake','database'=>'fake','socket'=>'/tmp/mysql.sock');
$mdb2=&MDB2::singleton($dsn,array('default_table_type'=>'InnoDB','use_transactions'=>true));
if (PEAR::isError($mdb2)) die($mdb2->getMessage());
$mdb2->setTransactionIsolation('READ COMMITTED');
echo '<pre>';
var_dump($mdb2->supports('transactions'));
var_dump($mdb2->supports('savepoints'));
echo '</pre>';
if ($mdb2->supports('transactions'))
echo 'transaction able';else
echo 'transaction disable';Results: bool(false) bool(false) transaction disable