From fd24adf31255822d6aa9a5d2dce9010ad2ee4cf0 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 4 Dec 2012 17:38:59 +0200 Subject: Remove CI_DB_oci8_result::data_seek() It can only call oci_execute() in order to reset the pointer to 0, the oci8 driver doesn't support setting the pointer. Due to the result_object(), result_array() and custom_result_object() calling data_seek() every time prior to fetching the result set, this only causes the query to be executed twice. All of the three methods now cast from existing result_object and/or result_array sets, so the probability to ever need to really fetch the result set again is practically zero and so this method doesn't bring any benefit. --- system/database/drivers/oci8/oci8_result.php | 63 ---------------------------- 1 file changed, 63 deletions(-) (limited to 'system') diff --git a/system/database/drivers/oci8/oci8_result.php b/system/database/drivers/oci8/oci8_result.php index 661ea4944..84d46f82a 100644 --- a/system/database/drivers/oci8/oci8_result.php +++ b/system/database/drivers/oci8/oci8_result.php @@ -216,69 +216,6 @@ class CI_DB_oci8_result extends CI_DB_result { return $class_name; } - // -------------------------------------------------------------------- - - /** - * Data Seek - * - * Moves the internal pointer to the desired offset. We call - * this internally before fetching results to make sure the - * result set starts at zero. - * - * Oracle's PHP extension doesn't have an easy way of doing this - * and the only workaround is to (re)execute the statement or cursor - * in order to go to the first (zero) index of the result set. - * Then, we would need to "dummy" fetch ($n - 1) rows to get to the - * right one. - * - * This is as ridiculous as it sounds and it's the reason why every - * other method that is fetching data tries to use an already "cached" - * result set. Keeping this just in case it becomes needed at - * some point in the future, but it will only work for resetting the - * pointer to zero. - * - * @param int $n (ignored) - * @return bool - */ - 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 - * rollback to be triggered at the end of the script execution. - * - * Therefore we'll try to avoid using that mode flag - * if we're not currently in the middle of a transaction. - */ - if ($this->commit_mode !== OCI_COMMIT_ON_SUCCESS) - { - $result = @oci_execute($this->stmt_id, $this->commit_mode); - } - else - { - $result = @oci_execute($this->stmt_id); - } - - if ($result && $this->curs_id) - { - if ($this->commit_mode !== OCI_COMMIT_ON_SUCCESS) - { - return @oci_execute($this->curs_id, $this->commit_mode); - } - else - { - return @oci_execute($this->curs_id); - } - } - - return $result; - } - } /* End of file oci8_result.php */ -- cgit v1.2.3-24-g4f1b