summaryrefslogtreecommitdiffstats
path: root/system/database/drivers
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2016-09-27 13:12:05 +0200
committerAndrey Andreev <narf@devilix.net>2016-09-27 13:12:05 +0200
commit8a15f5af819424087b6676709d98de6fa5fc6115 (patch)
treed29d38ac9211c8d047e4c6a51f1e2aa374a48a36 /system/database/drivers
parent7a49c0b0f12121be39001a13a97bd608f6a30a7a (diff)
Fix #4809
Diffstat (limited to 'system/database/drivers')
-rw-r--r--system/database/drivers/pdo/subdrivers/pdo_mysql_driver.php49
1 files changed, 49 insertions, 0 deletions
diff --git a/system/database/drivers/pdo/subdrivers/pdo_mysql_driver.php b/system/database/drivers/pdo/subdrivers/pdo_mysql_driver.php
index 3631cdf7a..6452b787b 100644
--- a/system/database/drivers/pdo/subdrivers/pdo_mysql_driver.php
+++ b/system/database/drivers/pdo/subdrivers/pdo_mysql_driver.php
@@ -216,6 +216,55 @@ class CI_DB_pdo_mysql_driver extends CI_DB_pdo_driver {
// --------------------------------------------------------------------
/**
+ * Begin Transaction
+ *
+ * @return bool
+ */
+ protected function _trans_begin()
+ {
+ $this->conn_id->setAttribute(PDO::ATTR_AUTOCOMMIT, FALSE);
+ return $this->conn_id->beginTransaction();
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Commit Transaction
+ *
+ * @return bool
+ */
+ protected function _trans_commit()
+ {
+ if ($this->conn_id->commit())
+ {
+ $this->conn_id->setAttribute(PDO::ATTR_AUTOCOMMIT, TRUE);
+ return TRUE;
+ }
+
+ return FALSE;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Rollback Transaction
+ *
+ * @return bool
+ */
+ protected function _trans_rollback()
+ {
+ if ($this->conn_id->rollBack())
+ {
+ $this->conn_id->setAttribute(PDO::ATTR_AUTOCOMMIT, TRUE);
+ return TRUE;
+ }
+
+ return FALSE;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
* Show table query
*
* Generates a platform-specific query string so that the table names can be fetched