postgresql - Zend: Rollback a commit? -


let's start transaction , finish commit:

$db->begintransaction(); // sql insert // sql insert // sql update // sql update $db->commit(); 

is there function can run after commit() revert changes made between begintransaction , commit() ?

after commit cannot revert changes reverting should call rollback instead.

rollback action done if 1 entity in transaction fails.therefore catch failure should use try{}catch{}

$db->begintransaction();  try{          $db->commit();//writes data database , reach new state  }catch(exception $e)   {       $db->rollback();//roll changes made database        echo  $e->gettraceasstring();  } 

Comments