我有这个奇怪的错误,我使用 MSSQL 2008 R2 和 ZendFw 1.12
首先..回滚在尝试中没有失败..
// Zend_DB_Table Adapter
$adapter = Zend_Db_Table::getDefaultAdapter();
// Start Transaction
$adapter->beginTransaction();
try {
$adapter->rollBack();
return (int) 1;
} catch (Exception $e) {
throw new Api_Exception($e->getMessage(), $e->getCode(), $e);
}
但是..回滚在catch里面失败了..
是的,我故意在尝试下面创建错误以使其进入 catch ..
// Zend_DB_Table Adapter
$adapter = Zend_Db_Table::getDefaultAdapter();
// Start Transaction
$adapter->beginTransaction();
try {
return (int) A;
} catch (Exception $e) {
$adapter->rollBack();
throw new Api_Exception($e->getMessage(), $e->getCode(), $e);
}
它返回..Zend_Db_Adapter_Sqlsrv_Exception: A transaction must be started by calling sqlsrv_begin_transaction before calling sqlsrv_commit or sqlsrv_rollback.
请问有什么线索吗?