Skip to content

Commit

Permalink
Fix a CI_DB_pdo_driver::trans_commit() bug
Browse files Browse the repository at this point in the history
  • Loading branch information
narfbg committed Apr 6, 2012
1 parent ea09a8a commit 80144bf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 24 deletions.
29 changes: 5 additions & 24 deletions system/database/drivers/pdo/pdo_driver.php
Expand Up @@ -290,13 +290,8 @@ protected function _execute($sql)
*/
public function trans_begin($test_mode = FALSE)
{
if ( ! $this->trans_enabled)
{
return TRUE;
}

// When transactions are nested we only begin/commit/rollback the outermost ones
if ($this->_trans_depth > 0)
if ( ! $this->trans_enabled OR $this->_trans_depth > 0)
{
return TRUE;
}
Expand All @@ -318,20 +313,13 @@ public function trans_begin($test_mode = FALSE)
*/
public function trans_commit()
{
if ( ! $this->trans_enabled)
{
return TRUE;
}

// When transactions are nested we only begin/commit/rollback the outermost ones
if ($this->_trans_depth > 0)
if ( ! $this->trans_enabled OR $this->_trans_depth > 0)
{
return TRUE;
}

$ret = $this->conn->commit();

return $ret;
return $this->conn_id->commit();
}

// --------------------------------------------------------------------
Expand All @@ -343,20 +331,13 @@ public function trans_commit()
*/
public function trans_rollback()
{
if ( ! $this->trans_enabled)
{
return TRUE;
}

// When transactions are nested we only begin/commit/rollback the outermost ones
if ($this->_trans_depth > 0)
if ( ! $this->trans_enabled OR $this->_trans_depth > 0)
{
return TRUE;
}

$ret = $this->conn_id->rollBack();

return $ret;
return $this->conn_id->rollBack();
}

// --------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions user_guide_src/source/changelog.rst
Expand Up @@ -199,6 +199,7 @@ Bug fixes for 3.0
- Fixed a bug (#1242) - read_dir() in the :doc:`Zip Library <libraries/zip>` wasn't compatible with Windows.
- Fixed a bug (#306) - ODBC driver didn't have an _insert_batch() method, which resulted in fatal error being triggered when insert_batch() is used with it.
- Fixed a bug in MSSQL and SQLSrv's _truncate() where the TABLE keyword was missing.
- Fixed a bug in PDO's trans_commit() method where it failed due to an erroneous property name.

Version 2.1.1
=============
Expand Down

0 comments on commit 80144bf

Please sign in to comment.