From 592f4ec753a35e75d4c83d5ce19975f3e7287a08 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 20 Mar 2012 15:10:08 +0200 Subject: Visibility declarations and cleanup for CI_DB_cubrid_driver --- system/database/drivers/cubrid/cubrid_driver.php | 124 +++++++++-------------- 1 file changed, 46 insertions(+), 78 deletions(-) (limited to 'system/database/drivers/cubrid') diff --git a/system/database/drivers/cubrid/cubrid_driver.php b/system/database/drivers/cubrid/cubrid_driver.php index 244707395..7b468bc5c 100644 --- a/system/database/drivers/cubrid/cubrid_driver.php +++ b/system/database/drivers/cubrid/cubrid_driver.php @@ -1,13 +1,13 @@ -port == '') { - $this->port = self::DEFAULT_PORT; + // Default CUBRID Broker port + $this->port = 33000; } $conn = cubrid_connect($this->hostname, $this->port, $this->database, $this->username, $this->password); @@ -101,6 +95,7 @@ class CI_DB_cubrid_driver extends CI_DB { /** * Persistent database connection + * * In CUBRID persistent DB connection is supported natively in CUBRID * engine which can be configured in the CUBRID Broker configuration * file by setting the CCI_PCONNECT parameter to ON. In that case, all @@ -109,10 +104,9 @@ class CI_DB_cubrid_driver extends CI_DB { * @cubrid_connect function will establish persisten connection * considering that the CCI_PCONNECT is ON. * - * @access private called by the base class * @return resource */ - function db_pconnect() + public function db_pconnect() { return $this->db_connect(); } @@ -125,10 +119,9 @@ class CI_DB_cubrid_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 (cubrid_ping($this->conn_id) === FALSE) { @@ -141,10 +134,9 @@ class CI_DB_cubrid_driver extends CI_DB { /** * Select the database * - * @access private called by the base class * @return resource */ - function db_select() + public function db_select() { // In CUBRID there is no need to select a database as the database // is chosen at the connection time. @@ -172,11 +164,10 @@ class CI_DB_cubrid_driver extends CI_DB { /** * Execute the query * - * @access private called by the base class * @param string an SQL query * @return resource */ - function _execute($sql) + protected function _execute($sql) { $sql = $this->_prep_query($sql); return @cubrid_query($sql, $this->conn_id); @@ -189,11 +180,10 @@ class CI_DB_cubrid_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) { // No need to prepare return $sql; @@ -204,10 +194,9 @@ class CI_DB_cubrid_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) { @@ -238,10 +227,9 @@ class CI_DB_cubrid_driver extends CI_DB { /** * Commit Transaction * - * @access public * @return bool */ - function trans_commit() + public function trans_commit() { if ( ! $this->trans_enabled) { @@ -269,10 +257,9 @@ class CI_DB_cubrid_driver extends CI_DB { /** * Rollback Transaction * - * @access public * @return bool */ - function trans_rollback() + public function trans_rollback() { if ( ! $this->trans_enabled) { @@ -300,12 +287,11 @@ class CI_DB_cubrid_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)) { @@ -352,10 +338,9 @@ class CI_DB_cubrid_driver extends CI_DB { /** * Insert ID * - * @access public - * @return integer + * @return int */ - function insert_id() + public function insert_id() { return @cubrid_insert_id($this->conn_id); } @@ -368,11 +353,10 @@ class CI_DB_cubrid_driver extends CI_DB { * Generates a platform-specific query string that counts all records in * the specified table * - * @access public * @param string - * @return string + * @return int */ - function count_all($table = '') + public function count_all($table = '') { if ($table == '') { @@ -397,11 +381,10 @@ class CI_DB_cubrid_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) { $sql = "SHOW TABLES"; @@ -420,11 +403,10 @@ class CI_DB_cubrid_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->protect_identifiers($table, TRUE, NULL, FALSE); } @@ -436,11 +418,10 @@ class CI_DB_cubrid_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) { return "SELECT * FROM ".$table." LIMIT 1"; } @@ -465,11 +446,10 @@ class CI_DB_cubrid_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 == '') { @@ -508,11 +488,10 @@ class CI_DB_cubrid_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)) { @@ -529,13 +508,12 @@ class CI_DB_cubrid_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 ".$table." (\"".implode('", "', $keys)."\") VALUES (".implode(', ', $values).")"; } @@ -548,13 +526,12 @@ class CI_DB_cubrid_driver extends CI_DB { * * Generates a platform-specific replace 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 _replace($table, $keys, $values) + protected function _replace($table, $keys, $values) { return "REPLACE INTO ".$table." (\"".implode('", "', $keys)."\") VALUES (".implode(', ', $values).")"; } @@ -566,13 +543,12 @@ class CI_DB_cubrid_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_batch($table, $keys, $values) + protected function _insert_batch($table, $keys, $values) { return "INSERT INTO ".$table." (\"".implode('", "', $keys)."\") VALUES ".implode(', ', $values); } @@ -585,7 +561,6 @@ class CI_DB_cubrid_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 @@ -593,7 +568,7 @@ class CI_DB_cubrid_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) { @@ -621,13 +596,12 @@ class CI_DB_cubrid_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 != '' AND count($where) >=1) ? implode(" ", $where).' AND ' : ''; @@ -668,7 +642,6 @@ class CI_DB_cubrid_driver extends CI_DB { // -------------------------------------------------------------------- - /** * Truncate statement * @@ -676,11 +649,10 @@ class CI_DB_cubrid_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 "TRUNCATE ".$table; } @@ -692,13 +664,12 @@ class CI_DB_cubrid_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 = ''; @@ -726,13 +697,12 @@ class CI_DB_cubrid_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 ($offset == 0) { @@ -751,17 +721,15 @@ class CI_DB_cubrid_driver extends CI_DB { /** * Close DB Connection * - * @access public * @param resource * @return void */ - function _close($conn_id) + protected function _close($conn_id) { @cubrid_close($conn_id); } } - /* End of file cubrid_driver.php */ /* Location: ./system/database/drivers/cubrid/cubrid_driver.php */ -- cgit v1.2.3-24-g4f1b From 32ed1cc894726aefc333870a7183e0e944c61c0e Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 20 Mar 2012 15:11:50 +0200 Subject: Visibility declarations and cleanup for CI_DB_cubrid_result --- system/database/drivers/cubrid/cubrid_result.php | 38 +++++++++--------------- 1 file changed, 14 insertions(+), 24 deletions(-) (limited to 'system/database/drivers/cubrid') diff --git a/system/database/drivers/cubrid/cubrid_result.php b/system/database/drivers/cubrid/cubrid_result.php index a7eeb8a39..6a61a213d 100644 --- a/system/database/drivers/cubrid/cubrid_result.php +++ b/system/database/drivers/cubrid/cubrid_result.php @@ -1,13 +1,13 @@ -result_id); } @@ -54,10 +51,9 @@ class CI_DB_cubrid_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 @cubrid_num_fields($this->result_id); } @@ -69,10 +65,9 @@ class CI_DB_cubrid_result extends CI_DB_result { * * Generates an array of column names * - * @access public * @return array */ - function list_fields() + public function list_fields() { return cubrid_column_names($this->result_id); } @@ -84,10 +79,9 @@ class CI_DB_cubrid_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() { $retval = array(); @@ -147,9 +141,9 @@ class CI_DB_cubrid_result extends CI_DB_result { /** * Free the result * - * @return null + * @return void */ - function free_result() + public function free_result() { if(is_resource($this->result_id) || get_resource_type($this->result_id) == "Unknown" && @@ -169,10 +163,9 @@ class CI_DB_cubrid_result extends CI_DB_result { * this internally before fetching results to make sure the * result set starts at zero * - * @access private * @return array */ - function _data_seek($n = 0) + protected function _data_seek($n = 0) { return cubrid_data_seek($this->result_id, $n); } @@ -184,10 +177,9 @@ class CI_DB_cubrid_result extends CI_DB_result { * * Returns the result set as an array * - * @access private * @return array */ - function _fetch_assoc() + protected function _fetch_assoc() { return cubrid_fetch_assoc($this->result_id); } @@ -199,16 +191,14 @@ class CI_DB_cubrid_result extends CI_DB_result { * * Returns the result set as an object * - * @access private * @return object */ - function _fetch_object() + protected function _fetch_object() { return cubrid_fetch_object($this->result_id); } } - /* End of file cubrid_result.php */ /* Location: ./system/database/drivers/cubrid/cubrid_result.php */ \ No newline at end of file -- cgit v1.2.3-24-g4f1b From 582d6a828221c8628faff91b62c5db981adbb1d8 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 20 Mar 2012 15:13:49 +0200 Subject: Visibility declarations and cleanup for CI_DB_cubrid_forge --- system/database/drivers/cubrid/cubrid_forge.php | 37 ++++++++++--------------- 1 file changed, 14 insertions(+), 23 deletions(-) (limited to 'system/database/drivers/cubrid') diff --git a/system/database/drivers/cubrid/cubrid_forge.php b/system/database/drivers/cubrid/cubrid_forge.php index 7d606ea36..bbda484c4 100644 --- a/system/database/drivers/cubrid/cubrid_forge.php +++ b/system/database/drivers/cubrid/cubrid_forge.php @@ -1,13 +1,13 @@ -$attributes) + foreach ($fields as $field => $attributes) { // Numeric field names aren't allowed in databases, so if the key is // numeric, we know it was assigned by PHP and the developer manually @@ -172,15 +167,14 @@ class CI_DB_cubrid_forge extends CI_DB_forge { /** * Create Table * - * @access private * @param string the table name * @param mixed the fields * @param mixed primary key(s) * @param mixed key(s) - * @param boolean should 'IF NOT EXISTS' be added to the SQL + * @param bool should 'IF NOT EXISTS' be added to the SQL * @return bool */ - function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) + public function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) { $sql = 'CREATE TABLE '; @@ -232,10 +226,9 @@ class CI_DB_cubrid_forge extends CI_DB_forge { /** * Drop Table * - * @access private * @return string */ - function _drop_table($table) + public function _drop_table($table) { return "DROP TABLE IF EXISTS ".$this->db->_escape_identifiers($table); } @@ -248,14 +241,13 @@ class CI_DB_cubrid_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 array fields * @param string the field after which we should add the new field - * @return object + * @return string */ - function _alter_table($alter_type, $table, $fields, $after_field = '') + public function _alter_table($alter_type, $table, $fields, $after_field = '') { $sql = 'ALTER TABLE '.$this->db->protect_identifiers($table).' '.$alter_type.' '; @@ -282,12 +274,11 @@ class CI_DB_cubrid_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 'RENAME TABLE '.$this->db->protect_identifiers($table_name).' AS '.$this->db->protect_identifiers($new_table_name); } @@ -295,4 +286,4 @@ class CI_DB_cubrid_forge extends CI_DB_forge { } /* End of file cubrid_forge.php */ -/* Location: ./system/database/drivers/cubrid/cubrid_forge.php */ +/* Location: ./system/database/drivers/cubrid/cubrid_forge.php */ \ No newline at end of file -- cgit v1.2.3-24-g4f1b From e3e3d50576608e0aa0428358b2fae2da29759901 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 20 Mar 2012 15:14:45 +0200 Subject: Visibility declarations and cleanup for CI_DB_cubrid_utility --- system/database/drivers/cubrid/cubrid_utility.php | 24 +++++++++-------------- 1 file changed, 9 insertions(+), 15 deletions(-) (limited to 'system/database/drivers/cubrid') diff --git a/system/database/drivers/cubrid/cubrid_utility.php b/system/database/drivers/cubrid/cubrid_utility.php index a13c0a5e4..dafd66146 100644 --- a/system/database/drivers/cubrid/cubrid_utility.php +++ b/system/database/drivers/cubrid/cubrid_utility.php @@ -1,13 +1,13 @@ -