diff options
author | Andrey Andreev <narf@devilix.net> | 2022-01-05 18:49:11 +0100 |
---|---|---|
committer | Andrey Andreev <narf@devilix.net> | 2022-01-05 18:49:11 +0100 |
commit | 4d545b6d05976b002829a8f75fe7054591c0b985 (patch) | |
tree | 2d78d79541e237d78cc435e9a10d3c7e423231a8 | |
parent | 546e102c3523375150c8e9f1ce4f07a6ea271eb0 (diff) |
[ci skip] Drop OCI8-specific get_cursor() and stored_procedure() methods
-rw-r--r-- | system/database/drivers/oci8/oci8_driver.php | 94 | ||||
-rw-r--r-- | system/database/drivers/oci8/oci8_result.php | 22 | ||||
-rw-r--r-- | user_guide_src/source/changelog.rst | 1 | ||||
-rw-r--r-- | user_guide_src/source/installation/upgrade_320.rst | 10 |
4 files changed, 15 insertions, 112 deletions
diff --git a/system/database/drivers/oci8/oci8_driver.php b/system/database/drivers/oci8/oci8_driver.php index 511ef0e64..d54624eda 100644 --- a/system/database/drivers/oci8/oci8_driver.php +++ b/system/database/drivers/oci8/oci8_driver.php @@ -76,13 +76,6 @@ class CI_DB_oci8_driver extends CI_DB { public $stmt_id; /** - * Cursor ID - * - * @var resource - */ - public $curs_id; - - /** * Commit mode flag * * @var int @@ -102,14 +95,6 @@ class CI_DB_oci8_driver extends CI_DB { // -------------------------------------------------------------------- /** - * Reset $stmt_id flag - * - * Used by stored_procedure() to prevent _execute() from - * re-setting the statement ID. - */ - protected $_reset_stmt_id = TRUE; - - /** * List of reserved identifiers * * Identifiers that must NOT be escaped. @@ -277,11 +262,7 @@ class CI_DB_oci8_driver extends CI_DB { /* Oracle must parse the query before it is run. All of the actions with * the query are based on the statement id returned by oci_parse(). */ - if ($this->_reset_stmt_id === TRUE) - { - $this->stmt_id = oci_parse($this->conn_id, $sql); - } - + $this->stmt_id = oci_parse($this->conn_id, $sql); oci_set_prefetch($this->stmt_id, 1000); return oci_execute($this->stmt_id, $this->commit_mode); } @@ -289,68 +270,6 @@ class CI_DB_oci8_driver extends CI_DB { // -------------------------------------------------------------------- /** - * Get cursor. Returns a cursor from the database - * - * @return resource - */ - public function get_cursor() - { - return $this->curs_id = oci_new_cursor($this->conn_id); - } - - // -------------------------------------------------------------------- - - /** - * Stored Procedure. Executes a stored procedure - * - * @param string package name in which the stored procedure is in - * @param string stored procedure name to execute - * @param array parameters - * @return mixed - * - * params array keys - * - * KEY OPTIONAL NOTES - * name no the name of the parameter should be in :<param_name> format - * value no the value of the parameter. If this is an OUT or IN OUT parameter, - * this should be a reference to a variable - * type yes the type of the parameter - * length yes the max size of the parameter - */ - public function stored_procedure($package, $procedure, array $params) - { - if ($package === '' OR $procedure === '') - { - log_message('error', 'Invalid query: '.$package.'.'.$procedure); - return ($this->db_debug) ? $this->display_error('db_invalid_query') : FALSE; - } - - // Build the query string - $sql = 'BEGIN '.$package.'.'.$procedure.'('; - - $have_cursor = FALSE; - foreach ($params as $param) - { - $sql .= $param['name'].','; - - if (isset($param['type']) && $param['type'] === OCI_B_CURSOR) - { - $have_cursor = TRUE; - } - } - $sql = trim($sql, ',').'); END;'; - - $this->_reset_stmt_id = FALSE; - $this->stmt_id = oci_parse($this->conn_id, $sql); - $this->_bind_params($params); - $result = $this->query($sql, FALSE, $have_cursor); - $this->_reset_stmt_id = TRUE; - return $result; - } - - // -------------------------------------------------------------------- - - /** * Bind parameters * * @param array $params @@ -562,11 +481,7 @@ class CI_DB_oci8_driver extends CI_DB { // oci_error() returns an array that already contains // 'code' and 'message' keys, but it can return false // if there was no error .... - if (is_resource($this->curs_id)) - { - $error = oci_error($this->curs_id); - } - elseif (is_resource($this->stmt_id)) + if (is_resource($this->stmt_id)) { $error = oci_error($this->stmt_id); } @@ -682,11 +597,6 @@ class CI_DB_oci8_driver extends CI_DB { */ protected function _close() { - if (is_resource($this->curs_id)) - { - oci_free_statement($this->curs_id); - } - if (is_resource($this->stmt_id)) { oci_free_statement($this->stmt_id); diff --git a/system/database/drivers/oci8/oci8_result.php b/system/database/drivers/oci8/oci8_result.php index 7fd911e82..99d3d1067 100644 --- a/system/database/drivers/oci8/oci8_result.php +++ b/system/database/drivers/oci8/oci8_result.php @@ -56,13 +56,6 @@ class CI_DB_oci8_result extends CI_DB_result { public $stmt_id; /** - * Cursor ID - * - * @var resource - */ - public $curs_id; - - /** * Limit used flag * * @var bool @@ -89,7 +82,6 @@ class CI_DB_oci8_result extends CI_DB_result { parent::__construct($driver_object); $this->stmt_id = $driver_object->stmt_id; - $this->curs_id = $driver_object->curs_id; $this->limit_used = $driver_object->limit_used; $this->commit_mode =& $driver_object->commit_mode; $driver_object->stmt_id = FALSE; @@ -173,12 +165,6 @@ class CI_DB_oci8_result extends CI_DB_result { { oci_free_statement($this->stmt_id); } - - if (is_resource($this->curs_id)) - { - oci_cancel($this->curs_id); - $this->curs_id = NULL; - } } // -------------------------------------------------------------------- @@ -192,8 +178,7 @@ class CI_DB_oci8_result extends CI_DB_result { */ protected function _fetch_assoc() { - $id = ($this->curs_id) ? $this->curs_id : $this->stmt_id; - return oci_fetch_assoc($id); + return oci_fetch_assoc($this->stmt_id); } // -------------------------------------------------------------------- @@ -208,9 +193,7 @@ class CI_DB_oci8_result extends CI_DB_result { */ protected function _fetch_object($class_name = 'stdClass') { - $row = ($this->curs_id) - ? oci_fetch_object($this->curs_id) - : oci_fetch_object($this->stmt_id); + $row = oci_fetch_object($this->stmt_id); if ($class_name === 'stdClass' OR ! $row) { @@ -225,5 +208,4 @@ class CI_DB_oci8_result extends CI_DB_result { return $class_name; } - } diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index b4278b1cd..704652381 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -76,6 +76,7 @@ Release Date: Not Released - :doc:`Database <database/index>` changes include: + - Removed driver-specific ``$curs_id`` property and ``get_cursor()``, ``stored_procedure()`` methods from OCI8 driver. - Removed previously deprecated 'sqlite' driver (used for SQLite version 2; no longer shipped with PHP 5.4+). - Removed method ``db_set_charset()`` and the ability to change a connection character set at runtime. - Changed method ``initialize()`` to return void and instead throw a ``RuntimeException`` in case of failure. diff --git a/user_guide_src/source/installation/upgrade_320.rst b/user_guide_src/source/installation/upgrade_320.rst index 3eadd8caf..2616a2a47 100644 --- a/user_guide_src/source/installation/upgrade_320.rst +++ b/user_guide_src/source/installation/upgrade_320.rst @@ -257,3 +257,13 @@ so that if you're using the :doc:`Web Page Caching <../general/caching>` feature, you'll be left with some old, garbage cache files. That shouldn't be a problem, but you may want to clear them. + +Step 13: Remove usage of OCI8 get_cursor() and stored_procedure() methods +========================================================================= + +The OCI8 :doc:`Database <database/index>` driver no longer has these two +methods that were specific to it and not present in other database drivers. +The ``$curs_id`` property is also removed. + +If you were using those, you can create your own cursors via ``oci_new_cursor()`` +and the publicly accessible ``$conn_id()``. |