php - Transaction not working -


i have following environment

wamp version : 2.4 apache version : 2.4.4
php version : 5.4.16

firebird/interbase support dynamic compile-time client library version firebird api version 25 run-time client library version wi-v6.3.0.26074 firebird 2.5

pdo pdo drivers firebird, mysql, sqlite

pdo_firebird

pdo driver firebird/interbase enabled following php code not working properly. transaction never rolled back.

<?php     require_once 'klogger.php';     $log = new klogger ( "log.txt" , klogger::debug );     try     {         $db = new pdo("firebird:dbname=my-server:mbooks-db", "sysdba", "masterkey");         $db->setattribute(pdo::attr_errmode, pdo::errmode_exception);         $result = $db->begintransaction();         $log->loginfo('transaction ' . $result);         $sql = "update control set code = code + 1 ( company_id = 26 ) , ( fin_year = '0000' ) , ( item = 'sal_id' )";         $stmt = $db->prepare($sql);         $stmt->execute();         //$db->commit();         $db->rollback();         $db = null;     }     catch (pdoexception $e)     {         $db->rollback();         $log->logerror($e->getmessage());     }     catch (clientprotocolexception $e)      {         $db->rollback();         $log->logerror($e->getmessage());     }     catch (ioexception $e)      {         $db->rollback();         $log->logerror($e->getmessage());     } ?> 

what problem?

can check if pdo::attr_autocommit 0

$db->setattribute(pdo::attr_autocommit,0); 

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -