From c7db6bb9b64c8322af4d727bcb71122cd7f09dbf Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 5 Jul 2012 15:11:20 +0300 Subject: Clean-up the separate drivers' DB result classes from no longer needed methods --- system/database/drivers/sqlite/sqlite_result.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'system/database/drivers/sqlite/sqlite_result.php') diff --git a/system/database/drivers/sqlite/sqlite_result.php b/system/database/drivers/sqlite/sqlite_result.php index 741dc9d8d..307dec5a9 100644 --- a/system/database/drivers/sqlite/sqlite_result.php +++ b/system/database/drivers/sqlite/sqlite_result.php @@ -33,6 +33,7 @@ * @category Database * @author EllisLab Dev Team * @link http://codeigniter.com/user_guide/database/ + * @since 1.3 */ class CI_DB_sqlite_result extends CI_DB_result { @@ -43,7 +44,9 @@ class CI_DB_sqlite_result extends CI_DB_result { */ public function num_rows() { - return @sqlite_num_rows($this->result_id); + return is_int($this->num_rows) + ? $this->num_rows + : $this->num_rows = @sqlite_num_rows($this->result_id); } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b From 9a4f356846daa078c077cbadb227524c857b8f97 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Fri, 6 Jul 2012 11:57:37 +0300 Subject: _fetch_object(), custom_result_object() to utilize PHP's native capability to directly return custom class results --- system/database/drivers/sqlite/sqlite_result.php | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'system/database/drivers/sqlite/sqlite_result.php') diff --git a/system/database/drivers/sqlite/sqlite_result.php b/system/database/drivers/sqlite/sqlite_result.php index 307dec5a9..eef9787a1 100644 --- a/system/database/drivers/sqlite/sqlite_result.php +++ b/system/database/drivers/sqlite/sqlite_result.php @@ -143,17 +143,12 @@ class CI_DB_sqlite_result extends CI_DB_result { * * Returns the result set as an object * + * @param string * @return object */ - protected function _fetch_object() + protected function _fetch_object($class_name = 'stdClass') { - if (function_exists('sqlite_fetch_object')) - { - return sqlite_fetch_object($this->result_id); - } - - $arr = sqlite_fetch_array($this->result_id, SQLITE_ASSOC); - return is_array($arr) ? (object) $arr : FALSE; + return sqlite_fetch_object($this->result_id, $class_name); } } -- cgit v1.2.3-24-g4f1b