I have the 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 Driver for Firebird/InterBase enabled but the following php code is not working properly. The transaction is 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 WHERE ( company_id = 26 ) AND ( fin_year = '0000' ) AND ( 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 could be the problem?
Can you check if PDO::ATTR_AUTOCOMMIT is 0
$db->setAttribute(PDO::ATTR_AUTOCOMMIT,0);