From da123732482727d33cafda557ae3047003592546 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 20 Mar 2012 22:27:40 +0200 Subject: Visibility declarations and cleanup for CI_DB_oci8_driver --- system/database/drivers/oci8/oci8_driver.php | 142 +++++++++++---------------- 1 file changed, 56 insertions(+), 86 deletions(-) (limited to 'system/database') diff --git a/system/database/drivers/oci8/oci8_driver.php b/system/database/drivers/oci8/oci8_driver.php index e3846bc1a..238a08ff8 100644 --- a/system/database/drivers/oci8/oci8_driver.php +++ b/system/database/drivers/oci8/oci8_driver.php @@ -1,13 +1,13 @@ -stmt_id)) { $this->stmt_id = oci_parse($this->conn_id, $sql); } } - + // -------------------------------------------------------------------- /** - * getCursor. Returns a cursor from the datbase + * Get cursor. Returns a cursor from the database * - * @access public - * @return cursor id + * @return cursor id */ public function get_cursor() { @@ -203,11 +193,10 @@ class CI_DB_oci8_driver extends CI_DB { /** * Stored Procedure. Executes a stored procedure * - * @access public - * @param package package stored procedure is in - * @param procedure stored procedure to execute - * @param params array of parameters - * @return array + * @param string package stored procedure is in + * @param string stored procedure to execute + * @param array parameters + * @return object * * params array keys * @@ -256,10 +245,9 @@ class CI_DB_oci8_driver extends CI_DB { /** * Bind parameters * - * @access private - * @return none + * @return void */ - private function _bind_params($params) + protected function _bind_params($params) { if ( ! is_array($params) OR ! is_resource($this->stmt_id)) { @@ -285,7 +273,6 @@ class CI_DB_oci8_driver extends CI_DB { /** * Begin Transaction * - * @access public * @return bool */ public function trans_begin($test_mode = FALSE) @@ -315,7 +302,6 @@ class CI_DB_oci8_driver extends CI_DB { /** * Commit Transaction * - * @access public * @return bool */ public function trans_commit() @@ -341,7 +327,6 @@ class CI_DB_oci8_driver extends CI_DB { /** * Rollback Transaction * - * @access public * @return bool */ public function trans_rollback() @@ -401,8 +386,7 @@ class CI_DB_oci8_driver extends CI_DB { /** * Affected Rows * - * @access public - * @return integer + * @return int */ public function affected_rows() { @@ -414,8 +398,7 @@ class CI_DB_oci8_driver extends CI_DB { /** * Insert ID * - * @access public - * @return integer + * @return int */ public function insert_id() { @@ -431,9 +414,8 @@ class CI_DB_oci8_driver extends CI_DB { * Generates a platform-specific query string that counts all records in * the specified database * - * @access public - * @param string - * @return string + * @param string + * @return string */ public function count_all($table = '') { @@ -460,8 +442,7 @@ class CI_DB_oci8_driver extends CI_DB { * * Generates a platform-specific query string so that the table names can be fetched * - * @access protected - * @param boolean + * @param bool * @return string */ protected function _list_tables($prefix_limit = FALSE) @@ -483,9 +464,8 @@ class CI_DB_oci8_driver extends CI_DB { * * Generates a platform-specific query string so that the column names can be fetched * - * @access protected - * @param string the table name - * @return string + * @param string the table name + * @return string */ protected function _list_columns($table = '') { @@ -499,9 +479,8 @@ class CI_DB_oci8_driver extends CI_DB { * * Generates a platform-specific query so that the column data can be retrieved * - * @access public - * @param string the table name - * @return object + * @param string the table name + * @return string */ protected function _field_data($table) { @@ -546,11 +525,10 @@ class CI_DB_oci8_driver extends CI_DB { * * This function escapes column and table names * - * @access protected * @param string * @return string */ - protected function _escape_identifiers($item) + public function _escape_identifiers($item) { if ($this->_escape_char == '') { @@ -589,9 +567,8 @@ class CI_DB_oci8_driver extends CI_DB { * This function implicitly groups FROM tables so there is no confusion * about operator precedence in harmony with SQL standards * - * @access protected - * @param type - * @return type + * @param array + * @return string */ protected function _from_tables($tables) { @@ -610,11 +587,10 @@ class CI_DB_oci8_driver extends CI_DB { * * Generates a platform-specific insert string from the supplied data * - * @access public - * @param string the table name - * @param array the insert keys - * @param array the insert values - * @return string + * @param string the table name + * @param array the insert keys + * @param array the insert values + * @return string */ protected function _insert($table, $keys, $values) { @@ -628,10 +604,10 @@ class CI_DB_oci8_driver extends CI_DB { * * Generates a platform-specific insert string from the supplied data * - * @param string the table name - * @param array the insert keys - * @param array the insert values - * @return string + * @param string the table name + * @param array the insert keys + * @param array the insert values + * @return string */ protected function _insert_batch($table, $keys, $values) { @@ -655,7 +631,6 @@ class CI_DB_oci8_driver extends CI_DB { * * Generates a platform-specific update string from the supplied data * - * @access protected * @param string the table name * @param array the update data * @param array the where clause @@ -692,7 +667,6 @@ class CI_DB_oci8_driver extends CI_DB { * If the database does not support the truncate() command * This function maps to "DELETE FROM table" * - * @access protected * @param string the table name * @return string */ @@ -708,7 +682,6 @@ class CI_DB_oci8_driver extends CI_DB { * * Generates a platform-specific delete string from the supplied data * - * @access protected * @param string the table name * @param array the where clause * @param string the limit clause @@ -742,11 +715,10 @@ class CI_DB_oci8_driver extends CI_DB { * * Generates a platform-specific LIMIT clause * - * @access protected - * @param string the sql query string - * @param integer the number of rows to limit the query to - * @param integer the offset value - * @return string + * @param string the sql query string + * @param int the number of rows to limit the query to + * @param int the offset value + * @return string */ protected function _limit($sql, $limit, $offset) { @@ -769,16 +741,14 @@ class CI_DB_oci8_driver extends CI_DB { /** * Close DB Connection * - * @access protected - * @param resource - * @return void + * @param resource + * @return void */ protected function _close($conn_id) { @oci_close($conn_id); } - } /* End of file oci8_driver.php */ -- cgit v1.2.3-24-g4f1b From 2f56fba915e35bcc7a36fbc047503d777decccd5 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 20 Mar 2012 22:32:20 +0200 Subject: Visibility declarations and cleanup for OCI8 result, forge and utility classes --- system/database/drivers/oci8/oci8_forge.php | 27 ++++++++-------------- system/database/drivers/oci8/oci8_result.php | 33 +++++++++------------------ system/database/drivers/oci8/oci8_utility.php | 25 ++++++++------------ 3 files changed, 31 insertions(+), 54 deletions(-) (limited to 'system/database') diff --git a/system/database/drivers/oci8/oci8_forge.php b/system/database/drivers/oci8/oci8_forge.php index 0a251998b..8285a29d2 100644 --- a/system/database/drivers/oci8/oci8_forge.php +++ b/system/database/drivers/oci8/oci8_forge.php @@ -1,13 +1,13 @@ -db->protect_identifiers($table).' '.$alter_type.' '.$this->db->protect_identifiers($column_name); @@ -212,12 +206,11 @@ class CI_DB_oci8_forge extends CI_DB_forge { * * Generates a platform-specific query so that a table can be renamed * - * @access private * @param string the old table name * @param string the new table name * @return string */ - function _rename_table($table_name, $new_table_name) + public function _rename_table($table_name, $new_table_name) { return 'ALTER TABLE '.$this->db->protect_identifiers($table_name).' RENAME TO '.$this->db->protect_identifiers($new_table_name); } diff --git a/system/database/drivers/oci8/oci8_result.php b/system/database/drivers/oci8/oci8_result.php index a14e32eec..c3f775730 100644 --- a/system/database/drivers/oci8/oci8_result.php +++ b/system/database/drivers/oci8/oci8_result.php @@ -1,13 +1,13 @@ -db->display_error('db_unsuported_feature'); } + } /* End of file oci8_utility.php */ -- cgit v1.2.3-24-g4f1b From bd44d5a7e12b8eb7f710021f92b6ffd79073cd43 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 20 Mar 2012 22:59:29 +0200 Subject: Visibility declarations and cleanup for CI_DB_pdo_driver --- system/database/drivers/pdo/pdo_driver.php | 186 ++++++++++++----------------- 1 file changed, 77 insertions(+), 109 deletions(-) (limited to 'system/database') diff --git a/system/database/drivers/pdo/pdo_driver.php b/system/database/drivers/pdo/pdo_driver.php index 9b44e7c64..0295b9d56 100644 --- a/system/database/drivers/pdo/pdo_driver.php +++ b/system/database/drivers/pdo/pdo_driver.php @@ -1,13 +1,13 @@ -_like_escape_str = " ESCAPE '%s' "; $this->_like_escape_chr = '!'; } - - $this->trans_enabled = FALSE; + + $this->trans_enabled = FALSE; $this->_random_keyword = ' RND('.time().')'; // database specific random keyword } /** * Connection String * - * @access private * @param array * @return void */ - function _connect_string($params) + protected function _connect_string($params) { if (strpos($this->hostname, ':')) { @@ -138,7 +135,7 @@ class CI_DB_pdo_driver extends CI_DB { $this->dsn = $this->pdodriver.':'; // Add hostname to the DSN for databases that need it - if ( ! empty($this->hostname) + if ( ! empty($this->hostname) && strpos($this->hostname, ':') === FALSE && in_array($this->pdodriver, array('informix', 'mysql', 'pgsql', 'sybase', 'mssql', 'dblib', 'cubrid'))) { @@ -153,7 +150,7 @@ class CI_DB_pdo_driver extends CI_DB { } // Add the database name to the DSN, if needed - if (stripos($this->dsn, 'dbname') === FALSE + if (stripos($this->dsn, 'dbname') === FALSE && in_array($this->pdodriver, array('4D', 'pgsql', 'mysql', 'firebird', 'sybase', 'mssql', 'dblib', 'cubrid'))) { $this->dsn .= 'dbname='.$this->database.';'; @@ -190,10 +187,9 @@ class CI_DB_pdo_driver extends CI_DB { /** * Non-persistent database connection * - * @access private called by the base class - * @return resource + * @return object */ - function db_connect() + public function db_connect() { $this->options[PDO::ATTR_ERRMODE] = PDO::ERRMODE_SILENT; @@ -205,14 +201,13 @@ class CI_DB_pdo_driver extends CI_DB { /** * Persistent database connection * - * @access private called by the base class - * @return resource + * @return object */ - function db_pconnect() + public function db_pconnect() { - $this->options[PDO::ATTR_ERRMODE] = PDO::ERRMODE_SILENT; + $this->options[PDO::ATTR_ERRMODE] = PDO::ERRMODE_SILENT; $this->options[PDO::ATTR_PERSISTENT] = TRUE; - + return $this->pdo_connect(); } @@ -221,23 +216,22 @@ class CI_DB_pdo_driver extends CI_DB { /** * PDO connection * - * @access private called by the PDO driver class - * @return resource + * @return object */ - function pdo_connect() + public function pdo_connect() { // Refer : http://php.net/manual/en/ref.pdo-mysql.connection.php - if ($this->pdodriver == 'mysql' && is_php('5.3.6')) + if ($this->pdodriver === 'mysql' && ! is_php('5.3.6')) { $this->options[PDO::MYSQL_ATTR_INIT_COMMAND] = "SET NAMES $this->char_set COLLATE '$this->dbcollat'"; } // Connecting... - try + try { $db = new PDO($this->dsn, $this->username, $this->password, $this->options); - } - catch (PDOException $e) + } + catch (PDOException $e) { if ($this->db_debug && empty($this->failover)) { @@ -258,10 +252,9 @@ class CI_DB_pdo_driver extends CI_DB { * Keep / reestablish the db connection if no queries have been * sent for a length of time exceeding the server's idle timeout * - * @access public * @return void */ - function reconnect() + public function reconnect() { if ($this->db->db_debug) { @@ -276,10 +269,9 @@ class CI_DB_pdo_driver extends CI_DB { /** * Select the database * - * @access private called by the base class * @return resource */ - function db_select() + public function db_select() { // Not needed for PDO return TRUE; @@ -304,16 +296,15 @@ class CI_DB_pdo_driver extends CI_DB { /** * Execute the query * - * @access private called by the base class * @param string an SQL query - * @return object + * @return mixed */ - function _execute($sql) + protected function _execute($sql) { $sql = $this->_prep_query($sql); $result_id = $this->conn_id->query($sql); - + if (is_object($result_id)) { $this->affect_rows = $result_id->rowCount(); @@ -322,7 +313,7 @@ class CI_DB_pdo_driver extends CI_DB { { $this->affect_rows = 0; } - + return $result_id; } @@ -333,11 +324,10 @@ class CI_DB_pdo_driver extends CI_DB { * * If needed, each database adapter can prep the query string * - * @access private called by execute() * @param string an SQL query * @return string */ - function _prep_query($sql) + protected function _prep_query($sql) { if ($this->pdodriver === 'pgsql') { @@ -358,10 +348,9 @@ class CI_DB_pdo_driver extends CI_DB { /** * Begin Transaction * - * @access public * @return bool */ - function trans_begin($test_mode = FALSE) + public function trans_begin($test_mode = FALSE) { if ( ! $this->trans_enabled) { @@ -387,10 +376,9 @@ class CI_DB_pdo_driver extends CI_DB { /** * Commit Transaction * - * @access public * @return bool */ - function trans_commit() + public function trans_commit() { if ( ! $this->trans_enabled) { @@ -404,7 +392,7 @@ class CI_DB_pdo_driver extends CI_DB { } $ret = $this->conn->commit(); - + return $ret; } @@ -413,10 +401,9 @@ class CI_DB_pdo_driver extends CI_DB { /** * Rollback Transaction * - * @access public * @return bool */ - function trans_rollback() + public function trans_rollback() { if ( ! $this->trans_enabled) { @@ -439,12 +426,11 @@ class CI_DB_pdo_driver extends CI_DB { /** * Escape String * - * @access public * @param string * @param bool whether or not the string will be used in a LIKE condition * @return string */ - function escape_str($str, $like = FALSE) + public function escape_str($str, $like = FALSE) { if (is_array($str)) { @@ -455,24 +441,22 @@ class CI_DB_pdo_driver extends CI_DB { return $str; } - + //Escape the string $str = $this->conn_id->quote($str); - + //If there are duplicated quotes, trim them away if (strpos($str, "'") === 0) { $str = substr($str, 1, -1); } - + // escape LIKE condition wildcards if ($like === TRUE) { - $str = str_replace( array('%', '_', $this->_like_escape_chr), - array($this->_like_escape_chr.'%', - $this->_like_escape_chr.'_', - $this->_like_escape_chr.$this->_like_escape_chr), - $str); + return str_replace(array($this->_like_escape_chr, '%', '_'), + array($this->_like_escape_chr.$this->_like_escape_chr, $this->_like_escape_chr.'%', $this->_like_escape_chr.'_'), + $str); } return $str; @@ -483,10 +467,9 @@ class CI_DB_pdo_driver extends CI_DB { /** * Affected Rows * - * @access public - * @return integer + * @return int */ - function affected_rows() + public function affected_rows() { return $this->affect_rows; } @@ -518,7 +501,6 @@ class CI_DB_pdo_driver extends CI_DB { * Generates a platform-specific query string that counts all records in * the specified database * - * @access public * @param string * @return string */ @@ -550,11 +532,10 @@ class CI_DB_pdo_driver extends CI_DB { * * Generates a platform-specific query string so that the table names can be fetched * - * @access private - * @param boolean + * @param bool * @return string */ - function _list_tables($prefix_limit = FALSE) + protected function _list_tables($prefix_limit = FALSE) { if ($this->pdodriver == 'pgsql') { @@ -573,7 +554,7 @@ class CI_DB_pdo_driver extends CI_DB { if ($prefix_limit !== FALSE AND $this->dbprefix != '') { - return FALSE; + return FALSE; } return $sql; @@ -586,11 +567,10 @@ class CI_DB_pdo_driver extends CI_DB { * * Generates a platform-specific query string so that the column names can be fetched * - * @access public * @param string the table name * @return string */ - function _list_columns($table = '') + protected function _list_columns($table = '') { return 'SHOW COLUMNS FROM '.$this->_from_tables($table); } @@ -602,11 +582,10 @@ class CI_DB_pdo_driver extends CI_DB { * * Generates a platform-specific query so that the column data can be retrieved * - * @access public * @param string the table name - * @return object + * @return string */ - function _field_data($table) + protected function _field_data($table) { if ($this->pdodriver == 'mysql' or $this->pdodriver == 'pgsql') { @@ -623,7 +602,7 @@ class CI_DB_pdo_driver extends CI_DB { // Analog function for sqlite return 'PRAGMA table_info('.$this->_from_tables($table).')'; } - + return 'SELECT TOP 1 FROM '.$this->_from_tables($table); } @@ -663,11 +642,10 @@ class CI_DB_pdo_driver extends CI_DB { * * This function escapes column and table names * - * @access private * @param string * @return string */ - function _escape_identifiers($item) + public function _escape_identifiers($item) { if ($this->_escape_char == '') { @@ -707,11 +685,10 @@ class CI_DB_pdo_driver extends CI_DB { * This function implicitly groups FROM tables so there is no confusion * about operator precedence in harmony with SQL standards * - * @access public - * @param type - * @return type + * @param array + * @return string */ - function _from_tables($tables) + protected function _from_tables($tables) { if ( ! is_array($tables)) { @@ -728,17 +705,16 @@ class CI_DB_pdo_driver extends CI_DB { * * Generates a platform-specific insert string from the supplied data * - * @access public * @param string the table name * @param array the insert keys * @param array the insert values * @return string */ - function _insert($table, $keys, $values) + protected function _insert($table, $keys, $values) { return 'INSERT INTO '.$this->_from_tables($table).' ('.implode(', ', $keys).') VALUES ('.implode(', ', $values).')'; } - + // -------------------------------------------------------------------- /** @@ -746,13 +722,12 @@ class CI_DB_pdo_driver extends CI_DB { * * Generates a platform-specific insert string from the supplied data * - * @access public - * @param string the table name - * @param array the insert keys - * @param array the insert values - * @return string + * @param string the table name + * @param array the insert keys + * @param array the insert values + * @return string */ - function _insert_batch($table, $keys, $values) + protected function _insert_batch($table, $keys, $values) { return 'INSERT INTO '.$this->_from_tables($table).' ('.implode(', ', $keys).') VALUES '.implode(', ', $values); } @@ -764,7 +739,6 @@ class CI_DB_pdo_driver extends CI_DB { * * Generates a platform-specific update string from the supplied data * - * @access public * @param string the table name * @param array the update data * @param array the where clause @@ -772,7 +746,7 @@ class CI_DB_pdo_driver extends CI_DB { * @param array the limit clause * @return string */ - function _update($table, $values, $where, $orderby = array(), $limit = FALSE) + protected function _update($table, $values, $where, $orderby = array(), $limit = FALSE) { foreach ($values as $key => $val) { @@ -788,7 +762,7 @@ class CI_DB_pdo_driver extends CI_DB { return $sql; } - + // -------------------------------------------------------------------- /** @@ -796,13 +770,12 @@ class CI_DB_pdo_driver extends CI_DB { * * Generates a platform-specific batch update string from the supplied data * - * @access public * @param string the table name * @param array the update data * @param array the where clause * @return string */ - function _update_batch($table, $values, $index, $where = NULL) + protected function _update_batch($table, $values, $index, $where = NULL) { $ids = array(); $where = ($where != '' && count($where) >=1) ? implode(" ", $where).' AND ' : ''; @@ -841,7 +814,6 @@ class CI_DB_pdo_driver extends CI_DB { return $sql; } - // -------------------------------------------------------------------- /** @@ -851,11 +823,10 @@ class CI_DB_pdo_driver extends CI_DB { * If the database does not support the truncate() command * This function maps to "DELETE FROM table" * - * @access public * @param string the table name * @return string */ - function _truncate($table) + protected function _truncate($table) { return $this->_delete($table); } @@ -867,13 +838,12 @@ class CI_DB_pdo_driver extends CI_DB { * * Generates a platform-specific delete string from the supplied data * - * @access public * @param string the table name * @param array the where clause * @param string the limit clause * @return string */ - function _delete($table, $where = array(), $like = array(), $limit = FALSE) + protected function _delete($table, $where = array(), $like = array(), $limit = FALSE) { $conditions = ''; @@ -902,13 +872,12 @@ class CI_DB_pdo_driver extends CI_DB { * * 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 + * @param int the number of rows to limit the query to + * @param int the offset value * @return string */ - function _limit($sql, $limit, $offset) + protected function _limit($sql, $limit, $offset) { if ($this->pdodriver == 'cubrid' OR $this->pdodriver == 'sqlite') { @@ -920,7 +889,7 @@ class CI_DB_pdo_driver extends CI_DB { { $sql .= 'LIMIT '.$limit; $sql .= ($offset > 0) ? ' OFFSET '.$offset : ''; - + return $sql; } } @@ -930,11 +899,10 @@ class CI_DB_pdo_driver extends CI_DB { /** * Close DB Connection * - * @access public * @param resource * @return void */ - function _close($conn_id) + protected function _close($conn_id) { $this->conn_id = null; } -- cgit v1.2.3-24-g4f1b From be22c5bcbea252da8133f5e3a2403f2e6bfcf90a Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 20 Mar 2012 23:01:53 +0200 Subject: Visibility declarations and cleanup for CI_DB_pdo_result --- system/database/drivers/pdo/pdo_result.php | 60 +++++++++++++----------------- 1 file changed, 25 insertions(+), 35 deletions(-) (limited to 'system/database') diff --git a/system/database/drivers/pdo/pdo_result.php b/system/database/drivers/pdo/pdo_result.php index 384b753da..5bbd85d75 100644 --- a/system/database/drivers/pdo/pdo_result.php +++ b/system/database/drivers/pdo/pdo_result.php @@ -1,13 +1,13 @@ -result_id) OR ! is_object($this->result_id)) { @@ -74,10 +71,9 @@ class CI_DB_pdo_result extends CI_DB_result { /** * Fetch the result handler * - * @access public * @return mixed */ - function result_assoc() + public function result_assoc() { // If the result already fetched before, use that one if (count($this->result_array) > 0 OR $this->is_fetched) @@ -94,7 +90,7 @@ class CI_DB_pdo_result extends CI_DB_result { // Define the method and handler $res_method = '_fetch_'.$type; $res_handler = 'result_'.$type; - + $this->$res_handler = array(); $this->_data_seek(0); @@ -116,10 +112,9 @@ class CI_DB_pdo_result extends CI_DB_result { /** * Number of fields in the result set * - * @access public - * @return integer + * @return int */ - function num_fields() + public function num_fields() { return $this->result_id->columnCount(); } @@ -131,16 +126,15 @@ class CI_DB_pdo_result extends CI_DB_result { * * Generates an array of column names * - * @access public - * @return array + * @return bool */ - function list_fields() + public function list_fields() { if ($this->db->db_debug) { return $this->db->display_error('db_unsuported_feature'); } - + return FALSE; } @@ -151,13 +145,12 @@ class CI_DB_pdo_result extends CI_DB_result { * * Generates an array of objects containing field meta-data * - * @access public * @return array */ - function field_data() + public function field_data() { $data = array(); - + try { if (strpos($this->result_id->queryString, 'PRAGMA') !== FALSE) @@ -173,7 +166,7 @@ class CI_DB_pdo_result extends CI_DB_result { $F->max_length = ( ! empty($matches[2])) ? preg_replace('/[^\d]/', '', $matches[2]) : NULL; $F->primary_key = (int) $field['pk']; $F->pdo_type = NULL; - + $data[] = $F; } } @@ -188,7 +181,7 @@ class CI_DB_pdo_result extends CI_DB_result { $F->type = $field['native_type']; $F->default = NULL; $F->pdo_type = $field['pdo_type']; - + if ($field['precision'] < 0) { $F->max_length = NULL; @@ -203,7 +196,7 @@ class CI_DB_pdo_result extends CI_DB_result { $data[] = $F; } } - + return $data; } catch (Exception $e) @@ -222,9 +215,9 @@ class CI_DB_pdo_result extends CI_DB_result { /** * Free the result * - * @return null + * @return void */ - function free_result() + public function free_result() { if (is_object($this->result_id)) { @@ -237,14 +230,13 @@ class CI_DB_pdo_result extends CI_DB_result { /** * Data Seek * - * Moves the internal pointer to the desired offset. We call + * Moves the internal pointer to the desired offset. We call * this internally before fetching results to make sure the * result set starts at zero * - * @access private - * @return array + * @return bool */ - function _data_seek($n = 0) + protected function _data_seek($n = 0) { return FALSE; } @@ -256,10 +248,9 @@ class CI_DB_pdo_result extends CI_DB_result { * * Returns the result set as an array * - * @access private * @return array */ - function _fetch_assoc() + protected function _fetch_assoc() { return $this->result_id->fetch(PDO::FETCH_ASSOC); } @@ -271,11 +262,10 @@ class CI_DB_pdo_result extends CI_DB_result { * * Returns the result set as an object * - * @access private * @return object */ - function _fetch_object() - { + protected function _fetch_object() + { return $this->result_id->fetchObject(); } -- cgit v1.2.3-24-g4f1b From 9fd79f568beb10194f3de66b14a484c2dddcaa95 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 20 Mar 2012 23:04:13 +0200 Subject: Visibility declarations and cleanup for PDO forge and utility classes --- system/database/drivers/pdo/pdo_forge.php | 32 +++++++++++------------------ system/database/drivers/pdo/pdo_utility.php | 24 ++++++++-------------- 2 files changed, 21 insertions(+), 35 deletions(-) (limited to 'system/database') diff --git a/system/database/drivers/pdo/pdo_forge.php b/system/database/drivers/pdo/pdo_forge.php index 2e5c81de3..6bff3542f 100644 --- a/system/database/drivers/pdo/pdo_forge.php +++ b/system/database/drivers/pdo/pdo_forge.php @@ -1,13 +1,13 @@ -db->db_debug) @@ -212,17 +206,16 @@ class CI_DB_pdo_forge extends CI_DB_forge { * Generates a platform-specific query so that a table can be altered * Called by add_column(), drop_column(), and column_alter(), * - * @access private * @param string the ALTER type (ADD, DROP, CHANGE) * @param string the column name * @param string the table name * @param string the column definition * @param string the default value - * @param boolean should 'NOT NULL' be added + * @param bool should 'NOT NULL' be added * @param string the field after which we should add the new field - * @return object + * @return string */ - function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '') + public function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '') { $sql = 'ALTER TABLE `'.$this->db->protect_identifiers($table).'` '.$alter_type.' '.$this->db->protect_identifiers($column_name); @@ -265,12 +258,11 @@ class CI_DB_pdo_forge extends CI_DB_forge { * * Generates a platform-specific query so that a table can be renamed * - * @access private * @param string the old table name * @param string the new table name * @return string */ - function _rename_table($table_name, $new_table_name) + public function _rename_table($table_name, $new_table_name) { return 'ALTER TABLE '.$this->db->protect_identifiers($table_name).' RENAME TO '.$this->db->protect_identifiers($new_table_name); } diff --git a/system/database/drivers/pdo/pdo_utility.php b/system/database/drivers/pdo/pdo_utility.php index c278c5172..86c798397 100644 --- a/system/database/drivers/pdo/pdo_utility.php +++ b/system/database/drivers/pdo/pdo_utility.php @@ -1,13 +1,13 @@ -db->db_debug) @@ -59,11 +56,10 @@ class CI_DB_pdo_utility extends CI_DB_utility { * * Generates a platform-specific query so that a table can be optimized * - * @access private * @param string the table name - * @return object + * @return bool */ - function _optimize_table($table) + public function _optimize_table($table) { // Not a supported PDO feature if ($this->db->db_debug) @@ -80,11 +76,10 @@ class CI_DB_pdo_utility extends CI_DB_utility { * * Generates a platform-specific query so that a table can be repaired * - * @access private * @param string the table name - * @return object + * @return bool */ - function _repair_table($table) + public function _repair_table($table) { // Not a supported PDO feature if ($this->db->db_debug) @@ -99,11 +94,10 @@ class CI_DB_pdo_utility extends CI_DB_utility { /** * PDO Export * - * @access private * @param array Preferences * @return mixed */ - function _backup($params = array()) + public function _backup($params = array()) { // Currently unsupported return $this->db->display_error('db_unsuported_feature'); -- cgit v1.2.3-24-g4f1b From 131772cbf8f19bc4f470f5abbdbe3f89125659d3 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 20 Mar 2012 23:35:03 +0200 Subject: Some small improvements to CI_DB_interbase_driver --- .../drivers/interbase/interbase_driver.php | 145 +++++++-------------- 1 file changed, 49 insertions(+), 96 deletions(-) (limited to 'system/database') diff --git a/system/database/drivers/interbase/interbase_driver.php b/system/database/drivers/interbase/interbase_driver.php index 9fa03adc7..977a84ecb 100644 --- a/system/database/drivers/interbase/interbase_driver.php +++ b/system/database/drivers/interbase/interbase_driver.php @@ -25,8 +25,6 @@ * @filesource */ -// ------------------------------------------------------------------------ - /** * Firebird/Interbase Database Adapter Class * @@ -56,8 +54,8 @@ class CI_DB_interbase_driver extends CI_DB { * database engines, so this string appears in each driver and is * used for the count_all() and count_all_results() functions. */ - protected $_count_string = "SELECT COUNT(*) AS "; - protected $_random_keyword = ' Random()'; // database specific random keyword + protected $_count_string = 'SELECT COUNT(*) AS '; + protected $_random_keyword = ' Random()'; // database specific random keyword // Keeps track of the resource for the current transaction protected $trans; @@ -160,13 +158,8 @@ class CI_DB_interbase_driver extends CI_DB { */ public function trans_begin($test_mode = FALSE) { - if ( ! $this->trans_enabled) - { - return TRUE; - } - // When transactions are nested we only begin/commit/rollback the outermost ones - if ($this->_trans_depth > 0) + if ( ! $this->trans_enabled OR $this->_trans_depth > 0) { return TRUE; } @@ -174,7 +167,7 @@ class CI_DB_interbase_driver extends CI_DB { // Reset the transaction failure flag. // If the $test_mode flag is set to TRUE transactions will be rolled back // even if the queries produce a successful result. - $this->_trans_failure = ($test_mode === TRUE) ? TRUE : FALSE; + $this->_trans_failure = ($test_mode === TRUE); $this->trans = @ibase_trans($this->conn_id); @@ -190,13 +183,8 @@ class CI_DB_interbase_driver extends CI_DB { */ public function trans_commit() { - if ( ! $this->trans_enabled) - { - return TRUE; - } - // When transactions are nested we only begin/commit/rollback the outermost ones - if ($this->_trans_depth > 0) + if ( ! $this->trans_enabled OR $this->_trans->depth > 0) { return TRUE; } @@ -213,13 +201,8 @@ class CI_DB_interbase_driver extends CI_DB { */ public function trans_rollback() { - if ( ! $this->trans_enabled) - { - return TRUE; - } - // When transactions are nested we only begin/commit/rollback the outermost ones - if ($this->_trans_depth > 0) + if ( ! $this->trans_enabled OR $this->_trans_depth > 0) { return TRUE; } @@ -251,9 +234,9 @@ class CI_DB_interbase_driver extends CI_DB { // escape LIKE condition wildcards if ($like === TRUE) { - $str = str_replace( array('%', '_', $this->_like_escape_chr), - array($this->_like_escape_chr.'%', $this->_like_escape_chr.'_', $this->_like_escape_chr.$this->_like_escape_chr), - $str); + return str_replace(array($this->_like_escape_chr, '%', '_'), + array($this->_like_escape_chr.$this->_like_escape_chr, $this->_like_escape_chr.'%', $this->_like_escape_chr.'_'), + $str); } return $str; @@ -264,7 +247,7 @@ class CI_DB_interbase_driver extends CI_DB { /** * Affected Rows * - * @return integer + * @return int */ public function affected_rows() { @@ -276,9 +259,9 @@ class CI_DB_interbase_driver extends CI_DB { /** * Insert ID * - * @param string $generator_name - * @param integer $inc_by - * @return integer + * @param string $generator_name + * @param int $inc_by + * @return int */ public function insert_id($generator_name, $inc_by=0) { @@ -310,9 +293,9 @@ class CI_DB_interbase_driver extends CI_DB { return 0; } - $row = $query->row(); + $query = $query->row(); $this->_reset_select(); - return (int) $row->numrows; + return (int) $query->numrows; } // -------------------------------------------------------------------- @@ -322,21 +305,18 @@ class CI_DB_interbase_driver extends CI_DB { * * Generates a platform-specific query string so that the table names can be fetched * - * @param boolean + * @param bool * @return string */ protected function _list_tables($prefix_limit = FALSE) { - $sql = <<dbprefix != '') + if ($prefix_limit !== FALSE && $this->dbprefix != '') { - $sql .= ' AND "RDB$RELATION_NAME" LIKE \''.$this->escape_like_str($this->dbprefix)."%' ".sprintf($this->_like_escape_str, $this->_like_escape_chr); + return $sql.' AND "RDB$RELATION_NAME" LIKE \''.$this->escape_like_str($this->dbprefix)."%' ".sprintf($this->_like_escape_str, $this->_like_escape_chr); } + return $sql; } @@ -352,10 +332,7 @@ SQL; */ protected function _list_columns($table = '') { - return <<escape_str($table)."'"; } // -------------------------------------------------------------------- @@ -366,14 +343,14 @@ SQL; * Generates a platform-specific query so that the column data can be retrieved * * @param string the table name - * @return object + * @return string */ protected function _field_data($table) { // Need to find a more efficient way to do this // but Interbase/Firebird seems to lack the // limit clause - return "SELECT * FROM {$table}"; + return 'SELECT * FROM '.$table; } // -------------------------------------------------------------------- @@ -407,24 +384,20 @@ SQL; { if (strpos($item, '.'.$id) !== FALSE) { - $str = $this->_escape_char. str_replace('.', $this->_escape_char.'.', $item); + $item = str_replace('.', $this->_escape_char.'.', $item); // remove duplicates if the user already included the escape - return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str); + return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $this->_escape_char.$item); } } if (strpos($item, '.') !== FALSE) { - $str = $this->_escape_char.str_replace('.', $this->_escape_char.'.'.$this->_escape_char, $item).$this->_escape_char; - } - else - { - $str = $this->_escape_char.$item.$this->_escape_char; + $item = str_replace('.', $this->_escape_char.'.'.$this->_escape_char, $item); } // remove duplicates if the user already included the escape - return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str); + return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $this->_escape_char.$item.$this->_escape_char); } // -------------------------------------------------------------------- @@ -435,8 +408,8 @@ SQL; * This public function implicitly groups FROM tables so there is no confusion * about operator precedence in harmony with SQL standards * - * @param type - * @return type + * @param array + * @return string */ protected function _from_tables($tables) { @@ -463,7 +436,7 @@ SQL; */ protected function _insert($table, $keys, $values) { - return "INSERT INTO {$table} (".implode(', ', $keys).') VALUES ('.implode(', ', $values).')'; + return 'INSERT INTO '.$table.' ('.implode(', ', $keys).') VALUES ('.implode(', ', $values).')'; } // -------------------------------------------------------------------- @@ -484,20 +457,14 @@ SQL; { foreach ($values as $key => $val) { - $valstr[] = $key." = ".$val; + $valstr[] = $key.' = '.$val; } //$limit = ( ! $limit) ? '' : ' LIMIT '.$limit; - $orderby = (count($orderby) >= 1)?' ORDER BY '.implode(", ", $orderby):''; - - $sql = "UPDATE {$table} SET ".implode(', ', $valstr); - - $sql .= ($where != '' AND count($where) >=1) ? ' WHERE '.implode(' ', $where) : ''; - - $sql .= $orderby; - - return $sql; + return 'UPDATE '.$table.' SET '.implode(', ', $valstr) + .(($where != '' && count($where) > 0) ? ' WHERE '.implode(' ', $where) : '') + .(count($orderby) > 0 ? ' ORDER BY '.implode(', ', $orderby) : ''); } @@ -532,23 +499,20 @@ SQL; */ protected function _delete($table, $where = array(), $like = array(), $limit = FALSE) { - $conditions = ''; - if (count($where) > 0 OR count($like) > 0) { - $conditions = "\nWHERE "; - $conditions .= implode("\n", $this->ar_where); - - if (count($where) > 0 && count($like) > 0) - { - $conditions .= ' AND '; - } - $conditions .= implode("\n", $like); + $conditions = "\nWHERE ".implode("\n", $where) + .((count($where) > 0 && count($like) > 0) ? ' AND ' : '') + .implode("\n", $like); + } + else + { + $conditions = ''; } //$limit = ( ! $limit) ? '' : ' LIMIT '.$limit; - return "DELETE FROM {$table}{$conditions}"; + return 'DELETE FROM '.$table.' '.$conditions; } // -------------------------------------------------------------------- @@ -559,36 +523,25 @@ SQL; * Generates a platform-specific LIMIT clause * * @param string the sql query string - * @param integer the number of rows to limit the query to - * @param integer the offset value + * @param int the number of rows to limit the query to + * @param int the offset value * @return string */ protected function _limit($sql, $limit, $offset) { - // Keep the current sql string safe for a moment - $orig_sql = $sql; - // Limit clause depends on if Interbase or Firebird if (stripos($this->version(), 'firebird') !== FALSE) { - $sql = 'FIRST '. (int) $limit; - - if ($offset > 0) - { - $sql .= ' SKIP '. (int) $offset; - } + $select = 'FIRST '. (int) $limit + .($offset > 0 ? ' SKIP '. (int) $offset : ''); } else { - $sql = 'ROWS ' . (int) $limit; - - if ($offset > 0) - { - $sql = 'ROWS '. (int) $offset . ' TO ' . ($limit + $offset); - } + $select = 'ROWS ' + .($offset > 0 ? (int) $offset.' TO '.($limit + $offset) : (int) $limit); } - return preg_replace('`SELECT`i', "SELECT {$sql}", $orig_sql); + return preg_replace('`SELECT`i', 'SELECT '.$select, $sql); } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b From 60c9c9990f635309965929e73d0bfe52d46253ca Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 20 Mar 2012 23:46:09 +0200 Subject: Some small improvements to CI_DB_interbase_result --- .../drivers/interbase/interbase_driver.php | 2 +- .../drivers/interbase/interbase_result.php | 85 +++++++++------------- 2 files changed, 35 insertions(+), 52 deletions(-) (limited to 'system/database') diff --git a/system/database/drivers/interbase/interbase_driver.php b/system/database/drivers/interbase/interbase_driver.php index 977a84ecb..326841dc2 100644 --- a/system/database/drivers/interbase/interbase_driver.php +++ b/system/database/drivers/interbase/interbase_driver.php @@ -310,7 +310,7 @@ class CI_DB_interbase_driver extends CI_DB { */ protected function _list_tables($prefix_limit = FALSE) { - $sql = 'SELECT "RDB$RELATION_NAME" FROM "RDB\$RELATIONS" WHERE "RDB$RELATION_NAME" NOT LIKE \'RDB$%\' AND "RDB$RELATION_NAME" NOT LIKE \'MON$%\''; + $sql = 'SELECT "RDB$RELATION_NAME" FROM "RDB$RELATIONS" WHERE "RDB$RELATION_NAME" NOT LIKE \'RDB$%\' AND "RDB$RELATION_NAME" NOT LIKE \'MON$%\''; if ($prefix_limit !== FALSE && $this->dbprefix != '') { diff --git a/system/database/drivers/interbase/interbase_result.php b/system/database/drivers/interbase/interbase_result.php index 5bf0c902d..fd4178dec 100644 --- a/system/database/drivers/interbase/interbase_result.php +++ b/system/database/drivers/interbase/interbase_result.php @@ -25,8 +25,6 @@ * @filesource */ -// ------------------------------------------------------------------------ - /** * Interbase/Firebird Result Class * @@ -43,18 +41,18 @@ class CI_DB_interbase_result extends CI_DB_result { /** * Number of rows in the result set * - * @return integer + * @return int */ public function num_rows() { - if( ! is_null($this->num_rows)) + if (is_int($this->num_rows)) { return $this->num_rows; } - - //Get the results so that you can get an accurate rowcount + + // Get the results so that you can get an accurate rowcount $this->result(); - + return $this->num_rows; } @@ -63,7 +61,7 @@ class CI_DB_interbase_result extends CI_DB_result { /** * Number of fields in the result set * - * @return integer + * @return int */ public function num_fields() { @@ -102,20 +100,17 @@ class CI_DB_interbase_result extends CI_DB_result { */ public function field_data() { - $retval = array(); - for ($i = 0, $num_fields = $this->num_fields(); $i < $num_fields; $i++) + for ($i = 0, $c = $this->num_fields(); $i < $c; $i++) { $info = ibase_field_info($this->result_id, $i); - - $F = new stdClass(); - $F->name = $info['name']; - $F->type = $info['type']; - $F->max_length = $info['length']; - $F->primary_key = 0; - $F->default = ''; - - $retval[] = $F; + + $retval[$i] = new stdClass(); + $retval[$i]->name = $info['name']; + $retval[$i]->type = $info['type']; + $retval[$i]->max_length = $info['length']; + $retval[$i]->primary_key = 0; + $retval[$i]->default = ''; } return $retval; @@ -126,7 +121,7 @@ class CI_DB_interbase_result extends CI_DB_result { /** * Free the result * - * @return null + * @return void */ public function free_result() { @@ -138,7 +133,7 @@ class CI_DB_interbase_result extends CI_DB_result { /** * Data Seek * - * Moves the internal pointer to the desired offset. We call + * Moves the internal pointer to the desired offset. We call * this internally before fetching results to make sure the * result set starts at zero * @@ -146,11 +141,8 @@ class CI_DB_interbase_result extends CI_DB_result { */ protected function _data_seek($n = 0) { - //Set the row count to 0 - $this->num_rows = 0; - - //Interbase driver doesn't implement a suitable function - return FALSE; + // Interbase driver doesn't implement a suitable function + return FALSE; } // -------------------------------------------------------------------- @@ -169,7 +161,7 @@ class CI_DB_interbase_result extends CI_DB_result { //Increment row count $this->num_rows++; } - + return $row; } @@ -189,10 +181,10 @@ class CI_DB_interbase_result extends CI_DB_result { //Increment row count $this->num_rows++; } - + return $row; } - + // -------------------------------------------------------------------- /** @@ -202,29 +194,20 @@ class CI_DB_interbase_result extends CI_DB_result { */ public function result_object() { - if (count($this->result_object) > 0) + if (count($this->result_object) === $this->num_rows) { return $this->result_object; } - - // Convert result array to object so that + + // Convert result array to object so that // We don't have to get the result again - if (count($this->result_array) > 0) + if (($c = count($this->result_array)) > 0) { - $i = 0; - - foreach ($this->result_array as $array) + for ($i = 0; $i < $c; $i++) { - $this->result_object[$i] = new StdClass(); - - foreach ($array as $key => $val) - { - $this->result_object[$i]->{$key} = $val; - } - - ++$i; + $this->result_object[$i] = (object) $this->result_array[$i]; } - + return $this->result_object; } @@ -254,20 +237,20 @@ class CI_DB_interbase_result extends CI_DB_result { */ public function result_array() { - if (count($this->result_array) > 0) + if (count($this->result_array) === $this->num_rows) { return $this->result_array; } - + // Since the object and array are really similar, just case // the result object to an array if need be - if (count($this->result_object) > 0) + if (($c = count($this->result_object)) > 0) { - foreach ($this->result_object as $obj) + for ($i = 0; $i < $c; $i++) { - $this->result_array[] = (array) $obj; + $this->result_array[$i] = (array) $this->result_object[$i]; } - + return $this->result_array; } -- cgit v1.2.3-24-g4f1b From 2cae193647045a83014972d2aae908e7ea0ac8f3 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Fri, 23 Mar 2012 16:08:41 +0200 Subject: Add dummy method reconnect() method to CI_DB_driver and remove it from drivers that don't support it --- system/database/DB_driver.php | 17 +++++++++++++++++ .../database/drivers/interbase/interbase_driver.php | 15 --------------- system/database/drivers/mssql/mssql_driver.php | 15 --------------- system/database/drivers/oci8/oci8_driver.php | 16 ---------------- system/database/drivers/odbc/odbc_driver.php | 15 --------------- system/database/drivers/pdo/pdo_driver.php | 20 -------------------- system/database/drivers/sqlite/sqlite_driver.php | 15 --------------- system/database/drivers/sqlsrv/sqlsrv_driver.php | 15 --------------- 8 files changed, 17 insertions(+), 111 deletions(-) (limited to 'system/database') diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php index 42b1b35aa..9f1a0b895 100644 --- a/system/database/DB_driver.php +++ b/system/database/DB_driver.php @@ -170,6 +170,23 @@ abstract class CI_DB_driver { // -------------------------------------------------------------------- + /** + * Reconnect + * + * Keep / reestablish the db connection if no queries have been + * sent for a length of time exceeding the server's idle timeout. + * + * This is just a dummy method to allow drivers without such + * functionality to not declare it, while others will override it. + * + * @return void + */ + public function reconnect() + { + } + + // -------------------------------------------------------------------- + /** * Set client character set * diff --git a/system/database/drivers/interbase/interbase_driver.php b/system/database/drivers/interbase/interbase_driver.php index 326841dc2..d8b6ae571 100644 --- a/system/database/drivers/interbase/interbase_driver.php +++ b/system/database/drivers/interbase/interbase_driver.php @@ -84,21 +84,6 @@ class CI_DB_interbase_driver extends CI_DB { // -------------------------------------------------------------------- - /** - * Reconnect - * - * Keep / reestablish the db connection if no queries have been - * sent for a length of time exceeding the server's idle timeout - * - * @return void - */ - public function reconnect() - { - // not implemented in Interbase/Firebird - } - - // -------------------------------------------------------------------- - /** * Select the database * diff --git a/system/database/drivers/mssql/mssql_driver.php b/system/database/drivers/mssql/mssql_driver.php index 1c1b84582..f2933fe43 100644 --- a/system/database/drivers/mssql/mssql_driver.php +++ b/system/database/drivers/mssql/mssql_driver.php @@ -91,21 +91,6 @@ class CI_DB_mssql_driver extends CI_DB { // -------------------------------------------------------------------- - /** - * Reconnect - * - * Keep / reestablish the db connection if no queries have been - * sent for a length of time exceeding the server's idle timeout - * - * @return void - */ - public function reconnect() - { - // not implemented in MSSQL - } - - // -------------------------------------------------------------------- - /** * Select the database * diff --git a/system/database/drivers/oci8/oci8_driver.php b/system/database/drivers/oci8/oci8_driver.php index 238a08ff8..c9e791d63 100644 --- a/system/database/drivers/oci8/oci8_driver.php +++ b/system/database/drivers/oci8/oci8_driver.php @@ -102,22 +102,6 @@ class CI_DB_oci8_driver extends CI_DB { // -------------------------------------------------------------------- - /** - * Reconnect - * - * Keep / reestablish the db connection if no queries have been - * sent for a length of time exceeding the server's idle timeout - * - * @return void - */ - public function reconnect() - { - // not implemented in oracle - return; - } - - // -------------------------------------------------------------------- - /** * Select the database * diff --git a/system/database/drivers/odbc/odbc_driver.php b/system/database/drivers/odbc/odbc_driver.php index 6704264c6..901787ff3 100644 --- a/system/database/drivers/odbc/odbc_driver.php +++ b/system/database/drivers/odbc/odbc_driver.php @@ -89,21 +89,6 @@ class CI_DB_odbc_driver extends CI_DB { // -------------------------------------------------------------------- - /** - * Reconnect - * - * Keep / reestablish the db connection if no queries have been - * sent for a length of time exceeding the server's idle timeout - * - * @return void - */ - public function reconnect() - { - // not implemented in odbc - } - - // -------------------------------------------------------------------- - /** * Select the database * diff --git a/system/database/drivers/pdo/pdo_driver.php b/system/database/drivers/pdo/pdo_driver.php index 0295b9d56..19338e30f 100644 --- a/system/database/drivers/pdo/pdo_driver.php +++ b/system/database/drivers/pdo/pdo_driver.php @@ -246,26 +246,6 @@ class CI_DB_pdo_driver extends CI_DB { // -------------------------------------------------------------------- - /** - * Reconnect - * - * Keep / reestablish the db connection if no queries have been - * sent for a length of time exceeding the server's idle timeout - * - * @return void - */ - public function reconnect() - { - if ($this->db->db_debug) - { - return $this->db->display_error('db_unsuported_feature'); - } - - return FALSE; - } - - // -------------------------------------------------------------------- - /** * Select the database * diff --git a/system/database/drivers/sqlite/sqlite_driver.php b/system/database/drivers/sqlite/sqlite_driver.php index bb86c2296..fa7e4846a 100644 --- a/system/database/drivers/sqlite/sqlite_driver.php +++ b/system/database/drivers/sqlite/sqlite_driver.php @@ -105,21 +105,6 @@ class CI_DB_sqlite_driver extends CI_DB { // -------------------------------------------------------------------- - /** - * Reconnect - * - * Keep / reestablish the db connection if no queries have been - * sent for a length of time exceeding the server's idle timeout - * - * @return void - */ - public function reconnect() - { - // not implemented in SQLite - } - - // -------------------------------------------------------------------- - /** * Select the database * diff --git a/system/database/drivers/sqlsrv/sqlsrv_driver.php b/system/database/drivers/sqlsrv/sqlsrv_driver.php index 2b9f82201..9f2f88699 100644 --- a/system/database/drivers/sqlsrv/sqlsrv_driver.php +++ b/system/database/drivers/sqlsrv/sqlsrv_driver.php @@ -100,21 +100,6 @@ class CI_DB_sqlsrv_driver extends CI_DB { // -------------------------------------------------------------------- - /** - * Reconnect - * - * Keep / reestablish the db connection if no queries have been - * sent for a length of time exceeding the server's idle timeout - * - * @return void - */ - public function reconnect() - { - // not implemented in MSSQL - } - - // -------------------------------------------------------------------- - /** * Select the database * -- cgit v1.2.3-24-g4f1b