Sunday, March 14, 2010

Transaction on CakePHP when using Oracle

Following my post on http://monmonja.com/blog/2008/07/transaction-on-cakephp-12/ where i use CakePHP and MySQL to do transaction, now i'm using oracle and $this->Model->begin() is not working and the fix for that is

$this->Model->begin();
$returnQuery = $this->Model->getDataSource()->query($query);
if($returnQuery !== false){
$this->Model->getDataSource()->commit();
}else{
$this->Model->getDataSource()->rollback();
}


Hope this helps