From 69edc4368d6c6588936b3b6c8bcb9d36626d363a Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 4 Dec 2012 13:32:16 +0200 Subject: Rename DB_result _data_seek() to data_seek() and make it publicly available (as requested in #2050) --- system/database/DB_result.php | 8 ++++---- system/database/drivers/cubrid/cubrid_result.php | 2 +- system/database/drivers/mssql/mssql_result.php | 2 +- system/database/drivers/mysql/mysql_result.php | 2 +- system/database/drivers/mysqli/mysqli_result.php | 2 +- system/database/drivers/oci8/oci8_result.php | 7 ++++++- system/database/drivers/postgre/postgre_result.php | 2 +- system/database/drivers/sqlite/sqlite_result.php | 2 +- system/database/drivers/sqlite3/sqlite3_result.php | 4 ++-- 9 files changed, 18 insertions(+), 13 deletions(-) (limited to 'system/database') diff --git a/system/database/DB_result.php b/system/database/DB_result.php index 9d19075ba..e1ef341a5 100644 --- a/system/database/DB_result.php +++ b/system/database/DB_result.php @@ -203,7 +203,7 @@ class CI_DB_result { return $this->custom_result_object[$class_name]; } - $this->_data_seek(0); + $this->data_seek(0); $this->custom_result_object[$class_name] = array(); while ($row = $this->_fetch_object($class_name)) @@ -246,7 +246,7 @@ class CI_DB_result { return $this->result_object; } - $this->_data_seek(0); + $this->data_seek(0); while ($row = $this->_fetch_object()) { $this->result_object[] = $row; @@ -287,7 +287,7 @@ class CI_DB_result { return $this->result_array; } - $this->_data_seek(0); + $this->data_seek(0); while ($row = $this->_fetch_assoc()) { $this->result_array[] = $row; @@ -617,7 +617,7 @@ class CI_DB_result { * @param int $n * @return bool */ - protected function _data_seek($n = 0) + public function data_seek($n = 0) { return FALSE; } diff --git a/system/database/drivers/cubrid/cubrid_result.php b/system/database/drivers/cubrid/cubrid_result.php index 130eea212..793b35b74 100644 --- a/system/database/drivers/cubrid/cubrid_result.php +++ b/system/database/drivers/cubrid/cubrid_result.php @@ -130,7 +130,7 @@ class CI_DB_cubrid_result extends CI_DB_result { * @param int $n * @return bool */ - protected function _data_seek($n = 0) + public function data_seek($n = 0) { return cubrid_data_seek($this->result_id, $n); } diff --git a/system/database/drivers/mssql/mssql_result.php b/system/database/drivers/mssql/mssql_result.php index a8f850d72..ca222aed4 100644 --- a/system/database/drivers/mssql/mssql_result.php +++ b/system/database/drivers/mssql/mssql_result.php @@ -135,7 +135,7 @@ class CI_DB_mssql_result extends CI_DB_result { * @param int $n * @return bool */ - protected function _data_seek($n = 0) + public function data_seek($n = 0) { return mssql_data_seek($this->result_id, $n); } diff --git a/system/database/drivers/mysql/mysql_result.php b/system/database/drivers/mysql/mysql_result.php index a6dcde4e7..293980e97 100644 --- a/system/database/drivers/mysql/mysql_result.php +++ b/system/database/drivers/mysql/mysql_result.php @@ -149,7 +149,7 @@ class CI_DB_mysql_result extends CI_DB_result { * @param int $n * @return bool */ - protected function _data_seek($n = 0) + public function data_seek($n = 0) { return $this->num_rows ? @mysql_data_seek($this->result_id, $n) diff --git a/system/database/drivers/mysqli/mysqli_result.php b/system/database/drivers/mysqli/mysqli_result.php index d55188e68..ac0f1a8d1 100644 --- a/system/database/drivers/mysqli/mysqli_result.php +++ b/system/database/drivers/mysqli/mysqli_result.php @@ -136,7 +136,7 @@ class CI_DB_mysqli_result extends CI_DB_result { * @param int $n * @return bool */ - protected function _data_seek($n = 0) + public function data_seek($n = 0) { return $this->result_id->data_seek($n); } diff --git a/system/database/drivers/oci8/oci8_result.php b/system/database/drivers/oci8/oci8_result.php index 7d5bf5172..661ea4944 100644 --- a/system/database/drivers/oci8/oci8_result.php +++ b/system/database/drivers/oci8/oci8_result.php @@ -240,8 +240,13 @@ class CI_DB_oci8_result extends CI_DB_result { * @param int $n (ignored) * @return bool */ - protected function _data_seek($n = 0) + public function data_seek($n = 0) { + if ($n > 0) + { + return FALSE; + } + /* The PHP manual says that if OCI_NO_AUTO_COMMIT mode * is used, and oci_rollback() and/or oci_commit() are * not subsequently called - this will cause an unnecessary diff --git a/system/database/drivers/postgre/postgre_result.php b/system/database/drivers/postgre/postgre_result.php index 3a4e57c42..fdaeaef70 100644 --- a/system/database/drivers/postgre/postgre_result.php +++ b/system/database/drivers/postgre/postgre_result.php @@ -133,7 +133,7 @@ class CI_DB_postgre_result extends CI_DB_result { * @param int $n * @return bool */ - protected function _data_seek($n = 0) + public function data_seek($n = 0) { return pg_result_seek($this->result_id, $n); } diff --git a/system/database/drivers/sqlite/sqlite_result.php b/system/database/drivers/sqlite/sqlite_result.php index 24f02a8b4..889757dea 100644 --- a/system/database/drivers/sqlite/sqlite_result.php +++ b/system/database/drivers/sqlite/sqlite_result.php @@ -117,7 +117,7 @@ class CI_DB_sqlite_result extends CI_DB_result { * @param int $n * @return bool */ - protected function _data_seek($n = 0) + public function data_seek($n = 0) { return sqlite_seek($this->result_id, $n); } diff --git a/system/database/drivers/sqlite3/sqlite3_result.php b/system/database/drivers/sqlite3/sqlite3_result.php index 44fef8909..69c42002c 100644 --- a/system/database/drivers/sqlite3/sqlite3_result.php +++ b/system/database/drivers/sqlite3/sqlite3_result.php @@ -175,10 +175,10 @@ class CI_DB_sqlite3_result extends CI_DB_result { * @param int $n (ignored) * @return array */ - protected function _data_seek($n = 0) + public function data_seek($n = 0) { // Only resetting to the start of the result set is supported - return $this->result_id->reset(); + return ($n > 0) ? FALSE : $this->result_id->reset(); } } -- cgit v1.2.3-24-g4f1b