From bb1d439a981023415569549d8b8c4987fa5b9b51 Mon Sep 17 00:00:00 2001 From: admin Date: Sun, 24 Sep 2006 20:14:38 +0000 Subject: --- system/database/drivers/oci8/oci8_driver.php | 121 ++++++++++++++------------- 1 file changed, 61 insertions(+), 60 deletions(-) (limited to 'system/database/drivers/oci8/oci8_driver.php') diff --git a/system/database/drivers/oci8/oci8_driver.php b/system/database/drivers/oci8/oci8_driver.php index 707394d53..bfc38a435 100644 --- a/system/database/drivers/oci8/oci8_driver.php +++ b/system/database/drivers/oci8/oci8_driver.php @@ -393,10 +393,10 @@ class CI_DB_oci8_driver extends CI_DB { /** * The error message string * - * @access public + * @access private * @return string */ - function error_message() + function _error_message() { $error = ocierror($this->conn_id); return $error['message']; @@ -407,10 +407,10 @@ class CI_DB_oci8_driver extends CI_DB { /** * The error message number * - * @access public + * @access private * @return integer */ - function error_number() + function _error_number() { $error = ocierror($this->conn_id); return $error['code']; @@ -424,11 +424,11 @@ class CI_DB_oci8_driver extends CI_DB { * This function adds backticks if the table name has a period * in it. Some DBs will get cranky unless periods are escaped * - * @access public + * @access private * @param string the table name * @return string */ - function escape_table($table) + function _escape_table($table) { if (stristr($table, '.')) { @@ -440,24 +440,6 @@ class CI_DB_oci8_driver extends CI_DB { // -------------------------------------------------------------------- - /** - * Field data query - * - * Generates a platform-specific query so that the column data can be retrieved - * - * @access public - * @param string the table name - * @return object - */ - function _field_data($table) - { - $sql = "SELECT * FROM ".$this->escape_table($table)." where rownum = 1"; - $query = $this->query($sql); - return $query->field_data(); - } - - // -------------------------------------------------------------------- - /** * Insert statement * @@ -471,7 +453,7 @@ class CI_DB_oci8_driver extends CI_DB { */ function _insert($table, $keys, $values) { - return "INSERT INTO ".$this->escape_table($table)." (".implode(', ', $keys).") VALUES (".implode(', ', $values).")"; + return "INSERT INTO ".$this->_escape_table($table)." (".implode(', ', $keys).") VALUES (".implode(', ', $values).")"; } // -------------------------------------------------------------------- @@ -494,7 +476,7 @@ class CI_DB_oci8_driver extends CI_DB { $valstr[] = $key." = ".$val; } - return "UPDATE ".$this->escape_table($table)." SET ".implode(', ', $valstr)." WHERE ".implode(" ", $where); + return "UPDATE ".$this->_escape_table($table)." SET ".implode(', ', $valstr)." WHERE ".implode(" ", $where); } // -------------------------------------------------------------------- @@ -511,7 +493,50 @@ class CI_DB_oci8_driver extends CI_DB { */ function _delete($table, $where) { - return "DELETE FROM ".$this->escape_table($table)." WHERE ".implode(" ", $where); + return "DELETE FROM ".$this->_escape_table($table)." WHERE ".implode(" ", $where); + } + + // -------------------------------------------------------------------- + + /** + * Limit string + * + * Generates a platform-specific LIMIT clause + * + * @access public + * @param string the sql query string + * @param integer the number of rows to limit the query to + * @param integer the offset value + * @return string + */ + function _limit($sql, $limit, $offset) + { + $limit = $offset + $limit; + $newsql = "SELECT * FROM (select inner_query.*, rownum rnum FROM ($sql) inner_query WHERE rownum < $limit)"; + + if ($offset != 0) + { + $newsql .= " WHERE rnum >= $offset"; + } + + // remember that we used limits + $this->limit_used = TRUE; + + return $newsql; + } + + // -------------------------------------------------------------------- + + /** + * Close DB Connection + * + * @access public + * @param resource + * @return void + */ + function _close($conn_id) + { + ocilogoff($conn_id); } // -------------------------------------------------------------------- @@ -562,46 +587,22 @@ class CI_DB_oci8_driver extends CI_DB { // -------------------------------------------------------------------- /** - * Limit string - * - * Generates a platform-specific LIMIT clause + * Field data query * - * @access public - * @param string the sql query string - * @param integer the number of rows to limit the query to - * @param integer the offset value - * @return string - */ - function _limit($sql, $limit, $offset) - { - $limit = $offset + $limit; - $newsql = "SELECT * FROM (select inner_query.*, rownum rnum FROM ($sql) inner_query WHERE rownum < $limit)"; - - if ($offset != 0) - { - $newsql .= " WHERE rnum >= $offset"; - } - - // remember that we used limits - $this->limit_used = TRUE; - - return $newsql; - } - - // -------------------------------------------------------------------- - - /** - * Close DB Connection + * Generates a platform-specific query so that the column data can be retrieved * * @access public - * @param resource - * @return void + * @param string the table name + * @return object */ - function _close($conn_id) + function _field_data($table) { - ocilogoff($conn_id); + $sql = "SELECT * FROM ".$this->_escape_table($table)." where rownum = 1"; + $query = $this->query($sql); + return $query->field_data(); } + } -- cgit v1.2.3-24-g4f1b