From f43a8fb104152f9fc2953967efb01cf542c1b338 Mon Sep 17 00:00:00 2001 From: jerkob Date: Thu, 23 Jan 2020 18:48:28 -0500 Subject: Add a trans_depth function Enables retrieval of the current _trans_depth --- system/database/DB_driver.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'system/database') diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php index b4f16b905..733522284 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; } + + // -------------------------------------------------------------------- + + /** + * Lets you retrieve the transaction depth + * + * @return int + */ + public function trans_depth() + { + return $this->_trans_depth; + } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b From 1cce9697265382853d9646ae3963fc20e6e97aa9 Mon Sep 17 00:00:00 2001 From: jerkob Date: Tue, 28 Jan 2020 11:20:47 -0500 Subject: Replace `trans_depth()` with `trans_active()` Per code review, replace `trans_depth()` function that returns the protected `_trans_depth` property with a `trans_active()` function that returns a boolean indicating whether a transaction is currently active. --- system/database/DB_driver.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'system/database') diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php index 733522284..96becd767 100644 --- a/system/database/DB_driver.php +++ b/system/database/DB_driver.php @@ -829,13 +829,13 @@ abstract class CI_DB_driver { // -------------------------------------------------------------------- /** - * Lets you retrieve the transaction depth + * Returns whether a transaction is currently active * - * @return int + * @return bool */ - public function trans_depth() + public function trans_active() { - return $this->_trans_depth; + return (bool) $this->_trans_depth; } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b From 259da38bedb09b4df1a94a922ec9b3e8d4f53d23 Mon Sep 17 00:00:00 2001 From: jerkob Date: Tue, 28 Jan 2020 11:30:44 -0500 Subject: Small tweak to `trans_active()` description --- system/database/DB_driver.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/database') diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php index 96becd767..f3433f849 100644 --- a/system/database/DB_driver.php +++ b/system/database/DB_driver.php @@ -829,7 +829,7 @@ abstract class CI_DB_driver { // -------------------------------------------------------------------- /** - * Returns whether a transaction is currently active + * Returns TRUE if a transaction is currently active * * @return bool */ -- cgit v1.2.3-24-g4f1b