?*?啟動事務
?*?@return?bool
?*/
public?function?begin()
{
if?($this->transDepth?==?0)
{
$this->query('START?TRANSACTION');
}
$this->transDepth++;
return?TRUE;
}
/**
?*?事務提交
?*?@return?bool
?*/
public?function?commit()
{
if?($this->transDepth?>?0)
{
$result?=?$this->query('COMMIT');
$this->transDepth?=?0;
if(!$result)?die("err:trans?commit?".mysql_error());
}
return?TRUE;
}
/**
?*?事務回滾
?*?@return?bool
?*/
public?function?rollback()
{
if?($this->transDepth?>?0)
{
$result?=?$this->query('ROLLBACK');
$this->transDepth?=?0;
if(!$result)?die("err:trans?commit?".mysql_error());
}
return?TRUE;
}