mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-07 18:51:41 +09:00
Prevent negative transaction level by unnecessary rollback or commit
This commit is contained in:
parent
922025ae8e
commit
4463eb8939
1 changed files with 20 additions and 2 deletions
|
|
@ -614,7 +614,11 @@ class DB
|
||||||
{
|
{
|
||||||
$this->_handle->exec(sprintf('ROLLBACK TO SAVEPOINT `%s%s%d`', $this->_prefix, 'savepoint', $this->_transaction_level - 1));
|
$this->_handle->exec(sprintf('ROLLBACK TO SAVEPOINT `%s%s%d`', $this->_prefix, 'savepoint', $this->_transaction_level - 1));
|
||||||
}
|
}
|
||||||
$this->_transaction_level--;
|
|
||||||
|
if ($this->_transaction_level > 0)
|
||||||
|
{
|
||||||
|
$this->_transaction_level--;
|
||||||
|
}
|
||||||
return $this->_transaction_level;
|
return $this->_transaction_level;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -649,7 +653,21 @@ class DB
|
||||||
Debug::addQuery($this->getQueryLog('NESTED COMMIT IGNORED BY RHYMIX', 0));
|
Debug::addQuery($this->getQueryLog('NESTED COMMIT IGNORED BY RHYMIX', 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->_transaction_level--;
|
|
||||||
|
if ($this->_transaction_level > 0)
|
||||||
|
{
|
||||||
|
$this->_transaction_level--;
|
||||||
|
}
|
||||||
|
return $this->_transaction_level;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the current transaction level.
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function getTransactionLevel(): int
|
||||||
|
{
|
||||||
return $this->_transaction_level;
|
return $this->_transaction_level;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue