Commit 8a1eac47 authored by Francesc Rosàs's avatar Francesc Rosàs

Log transaction statements

parent c8835edf
......@@ -899,10 +899,16 @@ class Connection implements DriverConnection
++$this->_transactionNestingLevel;
$logger = $this->_config->getSQLLogger();
if ($this->_transactionNestingLevel == 1) {
if ($logger) $logger->startQuery('"START TRANSACTION"');
$this->_conn->beginTransaction();
if ($logger) $logger->stopQuery();
} else if ($this->_nestTransactionsWithSavepoints) {
if ($logger) $logger->startQuery('"SAVEPOINT"');
$this->createSavepoint($this->_getNestedTransactionSavePointName());
if ($logger) $logger->stopQuery();
}
}
......@@ -924,10 +930,16 @@ class Connection implements DriverConnection
$this->connect();
$logger = $this->_config->getSQLLogger();
if ($this->_transactionNestingLevel == 1) {
if ($logger) $logger->startQuery('"COMMIT"');
$this->_conn->commit();
if ($logger) $logger->stopQuery();
} else if ($this->_nestTransactionsWithSavepoints) {
if ($logger) $logger->startQuery('"RELEASE SAVEPOINT"');
$this->releaseSavepoint($this->_getNestedTransactionSavePointName());
if ($logger) $logger->stopQuery();
}
--$this->_transactionNestingLevel;
......@@ -949,13 +961,19 @@ class Connection implements DriverConnection
$this->connect();
$logger = $this->_config->getSQLLogger();
if ($this->_transactionNestingLevel == 1) {
if ($logger) $logger->startQuery('"ROLLBACK"');
$this->_transactionNestingLevel = 0;
$this->_conn->rollback();
$this->_isRollbackOnly = false;
if ($logger) $logger->stopQuery();
} else if ($this->_nestTransactionsWithSavepoints) {
if ($logger) $logger->startQuery('"ROLLBACK TO SAVEPOINT"');
$this->rollbackSavepoint($this->_getNestedTransactionSavePointName());
--$this->_transactionNestingLevel;
if ($logger) $logger->stopQuery();
} else {
$this->_isRollbackOnly = true;
--$this->_transactionNestingLevel;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment