diff --git a/dibi/dibi.php b/dibi/dibi.php index 50a82bff..32d3fdf0 100644 --- a/dibi/dibi.php +++ b/dibi/dibi.php @@ -584,7 +584,7 @@ class dibi /** - * @deprecated + * @deprecated */ public static function datetime($time = NULL) { @@ -594,7 +594,7 @@ class dibi /** - * @deprecated + * @deprecated */ public static function date($date = NULL) { diff --git a/dibi/libs/DibiConnection.php b/dibi/libs/DibiConnection.php index 043e38e5..f53a652c 100644 --- a/dibi/libs/DibiConnection.php +++ b/dibi/libs/DibiConnection.php @@ -40,9 +40,6 @@ class DibiConnection extends DibiObject /** @var bool Is connected? */ private $connected = FALSE; - /** @var bool Is in transaction? */ - private $inTxn = FALSE; - /** @@ -153,9 +150,6 @@ class DibiConnection extends DibiObject final public function disconnect() { if ($this->connected) { - if ($this->inTxn) { - $this->rollback(); - } $this->driver->disconnect(); $this->connected = FALSE; } @@ -418,18 +412,10 @@ class DibiConnection extends DibiObject public function begin($savepoint = NULL) { $this->connect(); - if (!$savepoint && $this->inTxn) { - throw new DibiException('There is already an active transaction.'); - } if ($this->profiler !== NULL) { $ticket = $this->profiler->before($this, IDibiProfiler::BEGIN, $savepoint); } - if ($savepoint && !$this->inTxn) { - $this->driver->begin(); - } $this->driver->begin($savepoint); - - $this->inTxn = TRUE; if (isset($ticket)) { $this->profiler->after($ticket); } @@ -444,14 +430,10 @@ class DibiConnection extends DibiObject */ public function commit($savepoint = NULL) { - if (!$this->inTxn) { - throw new DibiException('There is no active transaction.'); - } if ($this->profiler !== NULL) { $ticket = $this->profiler->before($this, IDibiProfiler::COMMIT, $savepoint); } $this->driver->commit($savepoint); - $this->inTxn = (bool) $savepoint; if (isset($ticket)) { $this->profiler->after($ticket); } @@ -466,14 +448,10 @@ class DibiConnection extends DibiObject */ public function rollback($savepoint = NULL) { - if (!$this->inTxn) { - throw new DibiException('There is no active transaction.'); - } if ($this->profiler !== NULL) { $ticket = $this->profiler->before($this, IDibiProfiler::ROLLBACK, $savepoint); } $this->driver->rollback($savepoint); - $this->inTxn = (bool) $savepoint; if (isset($ticket)) { $this->profiler->after($ticket); } @@ -482,12 +460,11 @@ class DibiConnection extends DibiObject /** - * Is in transaction? - * @return bool + * @deprecated */ public function inTransaction() { - return $this->inTxn; + trigger_error('Deprecated: use "SELECT @@autocommit" query instead.', E_USER_WARNING); } diff --git a/dibi/libs/DibiTranslator.php b/dibi/libs/DibiTranslator.php index 4f9a549a..3f9ab922 100644 --- a/dibi/libs/DibiTranslator.php +++ b/dibi/libs/DibiTranslator.php @@ -429,7 +429,7 @@ final class DibiTranslator extends DibiObject } elseif ($value instanceof DateTime) { return $this->driver->escape($value, dibi::DATETIME); - } else { + } else { $this->hasError = TRUE; return '**Unexpected ' . gettype($value) . '**'; }