summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--system/database/DB_driver.php12
-rw-r--r--user_guide_src/source/database/db_driver_reference.rst7
2 files changed, 19 insertions, 0 deletions
diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php
index b4f16b905..f3433f849 100644
--- a/system/database/DB_driver.php
+++ b/system/database/DB_driver.php
@@ -825,6 +825,18 @@ abstract class CI_DB_driver {
{
return $this->_trans_status;
}
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Returns TRUE if a transaction is currently active
+ *
+ * @return bool
+ */
+ public function trans_active()
+ {
+ return (bool) $this->_trans_depth;
+ }
// --------------------------------------------------------------------
diff --git a/user_guide_src/source/database/db_driver_reference.rst b/user_guide_src/source/database/db_driver_reference.rst
index c240526e0..ad53c2bfc 100644
--- a/user_guide_src/source/database/db_driver_reference.rst
+++ b/user_guide_src/source/database/db_driver_reference.rst
@@ -161,6 +161,13 @@ This article is intended to be a reference for them.
Lets you retrieve the transaction status flag to
determine if it has failed.
+
+ .. php:method:: trans_active()
+
+ :returns: TRUE if a transaction is active, FALSE if not
+ :rtype: bool
+
+ Determines if a transaction is currently active.
.. php:method:: compile_binds($sql, $binds)