From 07c1ac830b4e98aa40f48baef3dd05fb68c0a836 Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Fri, 9 Mar 2012 17:03:37 +0000 Subject: Bumped CodeIgniter's PHP requirement to 5.2.4. Yes I know PHP 5.4 just came out, and yes I know PHP 5.3 has lovely features, but there are plenty of corporate systems running on CodeIgniter and PHP 5.3 still is not widely supported enough. CodeIgniter is great for distributed applications, and this is the highest we can reasonably go without breaking support. PHP 5.3 will most likely happen in another year or so. Fingers crossed on that one anyway... --- system/database/drivers/sqlite/sqlite_driver.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/database/drivers/sqlite/sqlite_driver.php') diff --git a/system/database/drivers/sqlite/sqlite_driver.php b/system/database/drivers/sqlite/sqlite_driver.php index 3eaec949c..efb372707 100644 --- a/system/database/drivers/sqlite/sqlite_driver.php +++ b/system/database/drivers/sqlite/sqlite_driver.php @@ -2,7 +2,7 @@ /** * CodeIgniter * - * An open source application development framework for PHP 5.1.6 or newer + * An open source application development framework for PHP 5.2.4 or newer * * NOTICE OF LICENSE * -- cgit v1.2.3-24-g4f1b From d2ff0bc1336e106e4b45abe7ee176bf6b9496b6e Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Mon, 19 Mar 2012 16:52:10 -0400 Subject: Removed pointless _prep_sql methods --- system/database/drivers/sqlite/sqlite_driver.php | 19 ------------------- 1 file changed, 19 deletions(-) (limited to 'system/database/drivers/sqlite/sqlite_driver.php') diff --git a/system/database/drivers/sqlite/sqlite_driver.php b/system/database/drivers/sqlite/sqlite_driver.php index 55d9bfdb8..1870e73b7 100644 --- a/system/database/drivers/sqlite/sqlite_driver.php +++ b/system/database/drivers/sqlite/sqlite_driver.php @@ -27,8 +27,6 @@ // ------------------------------------------------------------------------ - - /** * SQLite Database Adapter Class * @@ -163,28 +161,11 @@ class CI_DB_sqlite_driver extends CI_DB { */ function _execute($sql) { - $sql = $this->_prep_query($sql); return @sqlite_query($this->conn_id, $sql); } // -------------------------------------------------------------------- - /** - * Prep the query - * - * 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) - { - return $sql; - } - - // -------------------------------------------------------------------- - /** * Begin Transaction * -- cgit v1.2.3-24-g4f1b From 1ed5995be34f499aec8cd7b6d4d525a33017fd94 Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Mon, 19 Mar 2012 18:25:43 -0400 Subject: SQlite visibility declarations --- system/database/drivers/sqlite/sqlite_driver.php | 94 +++++++++--------------- 1 file changed, 34 insertions(+), 60 deletions(-) (limited to 'system/database/drivers/sqlite/sqlite_driver.php') diff --git a/system/database/drivers/sqlite/sqlite_driver.php b/system/database/drivers/sqlite/sqlite_driver.php index 1870e73b7..6535d2753 100644 --- a/system/database/drivers/sqlite/sqlite_driver.php +++ b/system/database/drivers/sqlite/sqlite_driver.php @@ -42,30 +42,29 @@ */ class CI_DB_sqlite_driver extends CI_DB { - var $dbdriver = 'sqlite'; + public $dbdriver = 'sqlite'; // The character used to escape with - not needed for SQLite - var $_escape_char = ''; + protected $_escape_char = ''; // clause and character used for LIKE escape sequences - var $_like_escape_str = " ESCAPE '%s' "; - var $_like_escape_chr = '!'; + protected $_like_escape_str = " ESCAPE '%s' "; + protected $_like_escape_chr = '!'; /** * The syntax to count rows is slightly different across different * database engines, so this string appears in each driver and is - * used for the count_all() and count_all_results() functions. + * used for the count_all() and count_all_results() public functions. */ - var $_count_string = "SELECT COUNT(*) AS "; - var $_random_keyword = ' Random()'; // database specific random keyword + protected $_count_string = "SELECT COUNT(*) AS "; + protected $_random_keyword = ' Random()'; // database specific random keyword /** * Non-persistent database connection * - * @access private called by the base class * @return resource */ - function db_connect() + protected function db_connect() { if ( ! $conn_id = @sqlite_open($this->database, FILE_WRITE_MODE, $error)) { @@ -87,10 +86,9 @@ class CI_DB_sqlite_driver extends CI_DB { /** * Persistent database connection * - * @access private called by the base class * @return resource */ - function db_pconnect() + protected function db_pconnect() { if ( ! $conn_id = @sqlite_popen($this->database, FILE_WRITE_MODE, $error)) { @@ -115,10 +113,9 @@ class CI_DB_sqlite_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() { // not implemented in SQLite } @@ -128,10 +125,9 @@ class CI_DB_sqlite_driver extends CI_DB { /** * Select the database * - * @access private called by the base class * @return resource */ - function db_select() + protected function db_select() { return TRUE; } @@ -155,11 +151,10 @@ class CI_DB_sqlite_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) { return @sqlite_query($this->conn_id, $sql); } @@ -169,10 +164,9 @@ class CI_DB_sqlite_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) { @@ -199,10 +193,9 @@ class CI_DB_sqlite_driver extends CI_DB { /** * Commit Transaction * - * @access public * @return bool */ - function trans_commit() + public function trans_commit() { if ( ! $this->trans_enabled) { @@ -224,10 +217,9 @@ class CI_DB_sqlite_driver extends CI_DB { /** * Rollback Transaction * - * @access public * @return bool */ - function trans_rollback() + public function trans_rollback() { if ( ! $this->trans_enabled) { @@ -249,12 +241,11 @@ class CI_DB_sqlite_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)) { @@ -284,10 +275,9 @@ class CI_DB_sqlite_driver extends CI_DB { /** * Affected Rows * - * @access public * @return integer */ - function affected_rows() + public function affected_rows() { return sqlite_changes($this->conn_id); } @@ -297,10 +287,9 @@ class CI_DB_sqlite_driver extends CI_DB { /** * Insert ID * - * @access public * @return integer */ - function insert_id() + public function insert_id() { return @sqlite_last_insert_rowid($this->conn_id); } @@ -313,11 +302,10 @@ class CI_DB_sqlite_driver extends CI_DB { * Generates a platform-specific query string that counts all records in * the specified database * - * @access public * @param string * @return string */ - function count_all($table = '') + public function count_all($table = '') { if ($table == '') { @@ -342,11 +330,10 @@ class CI_DB_sqlite_driver extends CI_DB { * * Generates a platform-specific query string so that the table names can be fetched * - * @access private * @param boolean * @return string */ - function _list_tables($prefix_limit = FALSE) + protected function _list_tables($prefix_limit = FALSE) { $sql = "SELECT name from sqlite_master WHERE type='table'"; @@ -364,11 +351,10 @@ class CI_DB_sqlite_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 = '') + public function _list_columns($table = '') { // Not supported return FALSE; @@ -381,11 +367,10 @@ class CI_DB_sqlite_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 */ - function _field_data($table) + public function _field_data($table) { return "SELECT * FROM ".$table." LIMIT 1"; } @@ -412,13 +397,12 @@ class CI_DB_sqlite_driver extends CI_DB { /** * Escape the SQL Identifiers * - * This function escapes column and table names + * This public function escapes column and table names * - * @access private * @param string * @return string */ - function _escape_identifiers($item) + protected function _escape_identifiers($item) { if ($this->_escape_char == '') { @@ -454,14 +438,13 @@ class CI_DB_sqlite_driver extends CI_DB { /** * From Tables * - * This function implicitly groups FROM tables so there is no confusion + * This public function implicitly groups FROM tables so there is no confusion * about operator precedence in harmony with SQL standards * - * @access public * @param type * @return type */ - function _from_tables($tables) + public function _from_tables($tables) { if ( ! is_array($tables)) { @@ -478,13 +461,12 @@ class CI_DB_sqlite_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) + public function _insert($table, $keys, $values) { return "INSERT INTO ".$table." (".implode(', ', $keys).") VALUES (".implode(', ', $values).")"; } @@ -496,7 +478,6 @@ class CI_DB_sqlite_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 @@ -504,7 +485,7 @@ class CI_DB_sqlite_driver extends CI_DB { * @param array the limit clause * @return string */ - function _update($table, $values, $where, $orderby = array(), $limit = FALSE) + public function _update($table, $values, $where, $orderby = array(), $limit = FALSE) { foreach ($values as $key => $val) { @@ -532,13 +513,12 @@ class CI_DB_sqlite_driver extends CI_DB { * * Generates a platform-specific truncate string from the supplied data * If the database does not support the truncate() command - * This function maps to "DELETE FROM table" + * This public function maps to "DELETE FROM table" * - * @access public * @param string the table name * @return string */ - function _truncate($table) + public function _truncate($table) { return $this->_delete($table); } @@ -550,13 +530,12 @@ class CI_DB_sqlite_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) + public function _delete($table, $where = array(), $like = array(), $limit = FALSE) { $conditions = ''; @@ -584,13 +563,12 @@ class CI_DB_sqlite_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 * @return string */ - function _limit($sql, $limit, $offset) + public function _limit($sql, $limit, $offset) { if ($offset == 0) { @@ -609,18 +587,14 @@ class CI_DB_sqlite_driver extends CI_DB { /** * Close DB Connection * - * @access public * @param resource * @return void */ - function _close($conn_id) + public function _close($conn_id) { @sqlite_close($conn_id); } - - } - /* End of file sqlite_driver.php */ -/* Location: ./system/database/drivers/sqlite/sqlite_driver.php */ +/* Location: ./system/database/drivers/sqlite/sqlite_driver.php */ \ No newline at end of file -- cgit v1.2.3-24-g4f1b From 691a8e747dc3b9a277488b133a5a02914ff210eb Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Mon, 19 Mar 2012 19:06:00 -0400 Subject: Revert "SQlite visibility declarations" This reverts commit 1ed5995be34f499aec8cd7b6d4d525a33017fd94. --- system/database/drivers/sqlite/sqlite_driver.php | 94 +++++++++++++++--------- 1 file changed, 60 insertions(+), 34 deletions(-) (limited to 'system/database/drivers/sqlite/sqlite_driver.php') diff --git a/system/database/drivers/sqlite/sqlite_driver.php b/system/database/drivers/sqlite/sqlite_driver.php index 6535d2753..1870e73b7 100644 --- a/system/database/drivers/sqlite/sqlite_driver.php +++ b/system/database/drivers/sqlite/sqlite_driver.php @@ -42,29 +42,30 @@ */ class CI_DB_sqlite_driver extends CI_DB { - public $dbdriver = 'sqlite'; + var $dbdriver = 'sqlite'; // The character used to escape with - not needed for SQLite - protected $_escape_char = ''; + var $_escape_char = ''; // clause and character used for LIKE escape sequences - protected $_like_escape_str = " ESCAPE '%s' "; - protected $_like_escape_chr = '!'; + var $_like_escape_str = " ESCAPE '%s' "; + var $_like_escape_chr = '!'; /** * The syntax to count rows is slightly different across different * database engines, so this string appears in each driver and is - * used for the count_all() and count_all_results() public functions. + * used for the count_all() and count_all_results() functions. */ - protected $_count_string = "SELECT COUNT(*) AS "; - protected $_random_keyword = ' Random()'; // database specific random keyword + var $_count_string = "SELECT COUNT(*) AS "; + var $_random_keyword = ' Random()'; // database specific random keyword /** * Non-persistent database connection * + * @access private called by the base class * @return resource */ - protected function db_connect() + function db_connect() { if ( ! $conn_id = @sqlite_open($this->database, FILE_WRITE_MODE, $error)) { @@ -86,9 +87,10 @@ class CI_DB_sqlite_driver extends CI_DB { /** * Persistent database connection * + * @access private called by the base class * @return resource */ - protected function db_pconnect() + function db_pconnect() { if ( ! $conn_id = @sqlite_popen($this->database, FILE_WRITE_MODE, $error)) { @@ -113,9 +115,10 @@ class CI_DB_sqlite_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 */ - public function reconnect() + function reconnect() { // not implemented in SQLite } @@ -125,9 +128,10 @@ class CI_DB_sqlite_driver extends CI_DB { /** * Select the database * + * @access private called by the base class * @return resource */ - protected function db_select() + function db_select() { return TRUE; } @@ -151,10 +155,11 @@ class CI_DB_sqlite_driver extends CI_DB { /** * Execute the query * + * @access private called by the base class * @param string an SQL query * @return resource */ - protected function _execute($sql) + function _execute($sql) { return @sqlite_query($this->conn_id, $sql); } @@ -164,9 +169,10 @@ class CI_DB_sqlite_driver extends CI_DB { /** * Begin Transaction * + * @access public * @return bool */ - public function trans_begin($test_mode = FALSE) + function trans_begin($test_mode = FALSE) { if ( ! $this->trans_enabled) { @@ -193,9 +199,10 @@ class CI_DB_sqlite_driver extends CI_DB { /** * Commit Transaction * + * @access public * @return bool */ - public function trans_commit() + function trans_commit() { if ( ! $this->trans_enabled) { @@ -217,9 +224,10 @@ class CI_DB_sqlite_driver extends CI_DB { /** * Rollback Transaction * + * @access public * @return bool */ - public function trans_rollback() + function trans_rollback() { if ( ! $this->trans_enabled) { @@ -241,11 +249,12 @@ class CI_DB_sqlite_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 */ - public function escape_str($str, $like = FALSE) + function escape_str($str, $like = FALSE) { if (is_array($str)) { @@ -275,9 +284,10 @@ class CI_DB_sqlite_driver extends CI_DB { /** * Affected Rows * + * @access public * @return integer */ - public function affected_rows() + function affected_rows() { return sqlite_changes($this->conn_id); } @@ -287,9 +297,10 @@ class CI_DB_sqlite_driver extends CI_DB { /** * Insert ID * + * @access public * @return integer */ - public function insert_id() + function insert_id() { return @sqlite_last_insert_rowid($this->conn_id); } @@ -302,10 +313,11 @@ class CI_DB_sqlite_driver extends CI_DB { * Generates a platform-specific query string that counts all records in * the specified database * + * @access public * @param string * @return string */ - public function count_all($table = '') + function count_all($table = '') { if ($table == '') { @@ -330,10 +342,11 @@ class CI_DB_sqlite_driver extends CI_DB { * * Generates a platform-specific query string so that the table names can be fetched * + * @access private * @param boolean * @return string */ - protected function _list_tables($prefix_limit = FALSE) + function _list_tables($prefix_limit = FALSE) { $sql = "SELECT name from sqlite_master WHERE type='table'"; @@ -351,10 +364,11 @@ class CI_DB_sqlite_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 */ - public function _list_columns($table = '') + function _list_columns($table = '') { // Not supported return FALSE; @@ -367,10 +381,11 @@ class CI_DB_sqlite_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 */ - public function _field_data($table) + function _field_data($table) { return "SELECT * FROM ".$table." LIMIT 1"; } @@ -397,12 +412,13 @@ class CI_DB_sqlite_driver extends CI_DB { /** * Escape the SQL Identifiers * - * This public function escapes column and table names + * This function escapes column and table names * + * @access private * @param string * @return string */ - protected function _escape_identifiers($item) + function _escape_identifiers($item) { if ($this->_escape_char == '') { @@ -438,13 +454,14 @@ class CI_DB_sqlite_driver extends CI_DB { /** * From Tables * - * This public function implicitly groups FROM tables so there is no confusion + * 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 */ - public function _from_tables($tables) + function _from_tables($tables) { if ( ! is_array($tables)) { @@ -461,12 +478,13 @@ class CI_DB_sqlite_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 */ - public function _insert($table, $keys, $values) + function _insert($table, $keys, $values) { return "INSERT INTO ".$table." (".implode(', ', $keys).") VALUES (".implode(', ', $values).")"; } @@ -478,6 +496,7 @@ class CI_DB_sqlite_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 @@ -485,7 +504,7 @@ class CI_DB_sqlite_driver extends CI_DB { * @param array the limit clause * @return string */ - public function _update($table, $values, $where, $orderby = array(), $limit = FALSE) + function _update($table, $values, $where, $orderby = array(), $limit = FALSE) { foreach ($values as $key => $val) { @@ -513,12 +532,13 @@ class CI_DB_sqlite_driver extends CI_DB { * * Generates a platform-specific truncate string from the supplied data * If the database does not support the truncate() command - * This public function maps to "DELETE FROM table" + * This function maps to "DELETE FROM table" * + * @access public * @param string the table name * @return string */ - public function _truncate($table) + function _truncate($table) { return $this->_delete($table); } @@ -530,12 +550,13 @@ class CI_DB_sqlite_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 */ - public function _delete($table, $where = array(), $like = array(), $limit = FALSE) + function _delete($table, $where = array(), $like = array(), $limit = FALSE) { $conditions = ''; @@ -563,12 +584,13 @@ class CI_DB_sqlite_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 * @return string */ - public function _limit($sql, $limit, $offset) + function _limit($sql, $limit, $offset) { if ($offset == 0) { @@ -587,14 +609,18 @@ class CI_DB_sqlite_driver extends CI_DB { /** * Close DB Connection * + * @access public * @param resource * @return void */ - public function _close($conn_id) + function _close($conn_id) { @sqlite_close($conn_id); } + + } + /* End of file sqlite_driver.php */ -/* Location: ./system/database/drivers/sqlite/sqlite_driver.php */ \ No newline at end of file +/* Location: ./system/database/drivers/sqlite/sqlite_driver.php */ -- cgit v1.2.3-24-g4f1b From 215890b015d219f0d31e8ad678b0b655e6923f3b Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Tue, 20 Mar 2012 09:38:16 -0400 Subject: Remove extraneous newlines --- system/database/drivers/sqlite/sqlite_driver.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/database/drivers/sqlite/sqlite_driver.php') diff --git a/system/database/drivers/sqlite/sqlite_driver.php b/system/database/drivers/sqlite/sqlite_driver.php index 1870e73b7..de72b5454 100644 --- a/system/database/drivers/sqlite/sqlite_driver.php +++ b/system/database/drivers/sqlite/sqlite_driver.php @@ -623,4 +623,4 @@ class CI_DB_sqlite_driver extends CI_DB { /* End of file sqlite_driver.php */ -/* Location: ./system/database/drivers/sqlite/sqlite_driver.php */ +/* Location: ./system/database/drivers/sqlite/sqlite_driver.php */ \ No newline at end of file -- cgit v1.2.3-24-g4f1b From 979b5280f98a962dd83a5b8923edd4eef224ce74 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 20 Mar 2012 16:45:39 +0200 Subject: Visibility declarations and cleanup for CI_DB_sqlite_driver --- system/database/drivers/sqlite/sqlite_driver.php | 109 +++++++++-------------- 1 file changed, 41 insertions(+), 68 deletions(-) (limited to 'system/database/drivers/sqlite/sqlite_driver.php') diff --git a/system/database/drivers/sqlite/sqlite_driver.php b/system/database/drivers/sqlite/sqlite_driver.php index de72b5454..bb86c2296 100644 --- a/system/database/drivers/sqlite/sqlite_driver.php +++ b/system/database/drivers/sqlite/sqlite_driver.php @@ -1,13 +1,13 @@ -database, FILE_WRITE_MODE, $error)) { @@ -87,10 +84,9 @@ class CI_DB_sqlite_driver extends CI_DB { /** * Persistent database connection * - * @access private called by the base class * @return resource */ - function db_pconnect() + public function db_pconnect() { if ( ! $conn_id = @sqlite_popen($this->database, FILE_WRITE_MODE, $error)) { @@ -115,10 +111,9 @@ class CI_DB_sqlite_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() { // not implemented in SQLite } @@ -128,10 +123,9 @@ class CI_DB_sqlite_driver extends CI_DB { /** * Select the database * - * @access private called by the base class * @return resource */ - function db_select() + public function db_select() { return TRUE; } @@ -155,11 +149,10 @@ class CI_DB_sqlite_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) { return @sqlite_query($this->conn_id, $sql); } @@ -169,10 +162,9 @@ class CI_DB_sqlite_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) { @@ -199,10 +191,9 @@ class CI_DB_sqlite_driver extends CI_DB { /** * Commit Transaction * - * @access public * @return bool */ - function trans_commit() + public function trans_commit() { if ( ! $this->trans_enabled) { @@ -224,10 +215,9 @@ class CI_DB_sqlite_driver extends CI_DB { /** * Rollback Transaction * - * @access public * @return bool */ - function trans_rollback() + public function trans_rollback() { if ( ! $this->trans_enabled) { @@ -249,12 +239,11 @@ class CI_DB_sqlite_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)) { @@ -284,10 +273,9 @@ class CI_DB_sqlite_driver extends CI_DB { /** * Affected Rows * - * @access public - * @return integer + * @return int */ - function affected_rows() + public function affected_rows() { return sqlite_changes($this->conn_id); } @@ -297,10 +285,9 @@ class CI_DB_sqlite_driver extends CI_DB { /** * Insert ID * - * @access public - * @return integer + * @return int */ - function insert_id() + public function insert_id() { return @sqlite_last_insert_rowid($this->conn_id); } @@ -313,11 +300,10 @@ class CI_DB_sqlite_driver extends CI_DB { * Generates a platform-specific query string that counts all records in * the specified database * - * @access public * @param string * @return string */ - function count_all($table = '') + public function count_all($table = '') { if ($table == '') { @@ -342,11 +328,10 @@ class CI_DB_sqlite_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 = "SELECT name from sqlite_master WHERE type='table'"; @@ -364,11 +349,10 @@ class CI_DB_sqlite_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 + * @return bool */ - function _list_columns($table = '') + protected function _list_columns($table = '') { // Not supported return FALSE; @@ -381,11 +365,10 @@ class CI_DB_sqlite_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"; } @@ -414,11 +397,10 @@ class CI_DB_sqlite_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 == '') { @@ -457,11 +439,10 @@ class CI_DB_sqlite_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)) { @@ -478,13 +459,12 @@ class CI_DB_sqlite_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).")"; } @@ -496,7 +476,6 @@ class CI_DB_sqlite_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 @@ -504,7 +483,7 @@ class CI_DB_sqlite_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) { @@ -534,11 +513,10 @@ class CI_DB_sqlite_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); } @@ -550,13 +528,12 @@ class CI_DB_sqlite_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 = ''; @@ -584,13 +561,12 @@ class CI_DB_sqlite_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) { @@ -609,18 +585,15 @@ class CI_DB_sqlite_driver extends CI_DB { /** * Close DB Connection * - * @access public * @param resource * @return void */ - function _close($conn_id) + protected function _close($conn_id) { @sqlite_close($conn_id); } - } - /* End of file sqlite_driver.php */ /* Location: ./system/database/drivers/sqlite/sqlite_driver.php */ \ No newline at end of file -- 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/drivers/sqlite/sqlite_driver.php | 15 --------------- 1 file changed, 15 deletions(-) (limited to 'system/database/drivers/sqlite/sqlite_driver.php') 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 * -- cgit v1.2.3-24-g4f1b From 94708bd62022f9a0cfb06d2f26e8441b6c4c562c Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 26 Mar 2012 12:09:28 +0300 Subject: Alter SQLite's escape_str() for LIKE queries --- system/database/drivers/sqlite/sqlite_driver.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'system/database/drivers/sqlite/sqlite_driver.php') diff --git a/system/database/drivers/sqlite/sqlite_driver.php b/system/database/drivers/sqlite/sqlite_driver.php index fa7e4846a..08b074cca 100644 --- a/system/database/drivers/sqlite/sqlite_driver.php +++ b/system/database/drivers/sqlite/sqlite_driver.php @@ -245,9 +245,9 @@ class CI_DB_sqlite_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; -- cgit v1.2.3-24-g4f1b From 830f5af4bac8da4b6f9392334348bc9e33b09240 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 26 Mar 2012 12:11:38 +0300 Subject: Add a missing comma --- system/database/drivers/sqlite/sqlite_driver.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/database/drivers/sqlite/sqlite_driver.php') diff --git a/system/database/drivers/sqlite/sqlite_driver.php b/system/database/drivers/sqlite/sqlite_driver.php index 08b074cca..102c79bb3 100644 --- a/system/database/drivers/sqlite/sqlite_driver.php +++ b/system/database/drivers/sqlite/sqlite_driver.php @@ -246,7 +246,7 @@ class CI_DB_sqlite_driver extends CI_DB { if ($like === TRUE) { 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.'_') + array($this->_like_escape_chr.$this->_like_escape_chr, $this->_like_escape_chr.'%', $this->_like_escape_chr.'_'), $str); } -- cgit v1.2.3-24-g4f1b From bee6644ce280d8e72cc2db23c86d5f5f6973acf3 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 28 Mar 2012 15:28:19 +0300 Subject: Add a dummy db_select() method to CI_DB_driver and remove it from drivers that don't have such functionality --- system/database/drivers/sqlite/sqlite_driver.php | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'system/database/drivers/sqlite/sqlite_driver.php') diff --git a/system/database/drivers/sqlite/sqlite_driver.php b/system/database/drivers/sqlite/sqlite_driver.php index 102c79bb3..ef543c9b5 100644 --- a/system/database/drivers/sqlite/sqlite_driver.php +++ b/system/database/drivers/sqlite/sqlite_driver.php @@ -105,18 +105,6 @@ class CI_DB_sqlite_driver extends CI_DB { // -------------------------------------------------------------------- - /** - * Select the database - * - * @return resource - */ - public function db_select() - { - return TRUE; - } - - // -------------------------------------------------------------------- - /** * Database version number * -- cgit v1.2.3-24-g4f1b From 65d537ce35cc01c2f31144d695725255322cb792 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 5 Apr 2012 14:11:41 +0300 Subject: Replaced driver instances of _insert() with one in CI_DB_active_record --- system/database/drivers/sqlite/sqlite_driver.php | 17 ----------------- 1 file changed, 17 deletions(-) (limited to 'system/database/drivers/sqlite/sqlite_driver.php') diff --git a/system/database/drivers/sqlite/sqlite_driver.php b/system/database/drivers/sqlite/sqlite_driver.php index ef543c9b5..5bfa42b08 100644 --- a/system/database/drivers/sqlite/sqlite_driver.php +++ b/system/database/drivers/sqlite/sqlite_driver.php @@ -427,23 +427,6 @@ class CI_DB_sqlite_driver extends CI_DB { // -------------------------------------------------------------------- - /** - * Insert statement - * - * 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 - */ - protected function _insert($table, $keys, $values) - { - return "INSERT INTO ".$table." (".implode(', ', $keys).") VALUES (".implode(', ', $values).")"; - } - - // -------------------------------------------------------------------- - /** * Update statement * -- cgit v1.2.3-24-g4f1b From 975034d50ed7b3c530631ba3e24a73e33be24eff Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 5 Apr 2012 15:09:55 +0300 Subject: Added a default _update() method to CI_DB_active_record --- system/database/drivers/sqlite/sqlite_driver.php | 35 ------------------------ 1 file changed, 35 deletions(-) (limited to 'system/database/drivers/sqlite/sqlite_driver.php') diff --git a/system/database/drivers/sqlite/sqlite_driver.php b/system/database/drivers/sqlite/sqlite_driver.php index 5bfa42b08..627420295 100644 --- a/system/database/drivers/sqlite/sqlite_driver.php +++ b/system/database/drivers/sqlite/sqlite_driver.php @@ -425,41 +425,6 @@ class CI_DB_sqlite_driver extends CI_DB { return '('.implode(', ', $tables).')'; } - // -------------------------------------------------------------------- - - /** - * Update statement - * - * Generates a platform-specific update string from the supplied data - * - * @param string the table name - * @param array the update data - * @param array the where clause - * @param array the orderby clause - * @param array the limit clause - * @return string - */ - protected function _update($table, $values, $where, $orderby = array(), $limit = FALSE) - { - foreach ($values as $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.$limit; - - return $sql; - } - - // -------------------------------------------------------------------- /** -- cgit v1.2.3-24-g4f1b From 17ceeae7ddd5c4eba2b1d0b25a17706b3d873346 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 5 Apr 2012 15:38:30 +0300 Subject: Add replace() support for SQLite/SQLite3 --- system/database/drivers/sqlite/sqlite_driver.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'system/database/drivers/sqlite/sqlite_driver.php') diff --git a/system/database/drivers/sqlite/sqlite_driver.php b/system/database/drivers/sqlite/sqlite_driver.php index 627420295..12908effb 100644 --- a/system/database/drivers/sqlite/sqlite_driver.php +++ b/system/database/drivers/sqlite/sqlite_driver.php @@ -427,6 +427,23 @@ class CI_DB_sqlite_driver extends CI_DB { // -------------------------------------------------------------------- + /** + * Replace statement + * + * Generates a platform-specific replace string from the supplied data + * + * @param string the table name + * @param array the insert keys + * @param array the insert values + * @return string + */ + protected function _replace($table, $keys, $values) + { + return 'INSERT OR '.parent::_replace($table, $keys, $values); + } + + // -------------------------------------------------------------------- + /** * Truncate statement * -- cgit v1.2.3-24-g4f1b From a6fe36eb42e5d8df8336f8c711ff8a6e0ee509e7 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 5 Apr 2012 16:00:32 +0300 Subject: Added a default _truncate() method to CI_DB_active_record --- system/database/drivers/sqlite/sqlite_driver.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'system/database/drivers/sqlite/sqlite_driver.php') diff --git a/system/database/drivers/sqlite/sqlite_driver.php b/system/database/drivers/sqlite/sqlite_driver.php index 12908effb..9c611f2fd 100644 --- a/system/database/drivers/sqlite/sqlite_driver.php +++ b/system/database/drivers/sqlite/sqlite_driver.php @@ -448,15 +448,16 @@ class CI_DB_sqlite_driver extends CI_DB { * Truncate statement * * Generates a platform-specific truncate string from the supplied data - * If the database does not support the truncate() command - * This function maps to "DELETE FROM table" + * + * If the database does not support the truncate() command, + * then this function maps to 'DELETE FROM table' * * @param string the table name * @return string */ protected function _truncate($table) { - return $this->_delete($table); + return 'DELETE FROM '.$table; } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b From ea09a8a5552f2aacdeab0c88a605fe44047ebd0a Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Fri, 6 Apr 2012 20:50:07 +0300 Subject: Renamed _escape_identifiers() to escape_identifiers() and moved it to CI_DB_driver --- system/database/drivers/sqlite/sqlite_driver.php | 41 ------------------------ 1 file changed, 41 deletions(-) (limited to 'system/database/drivers/sqlite/sqlite_driver.php') diff --git a/system/database/drivers/sqlite/sqlite_driver.php b/system/database/drivers/sqlite/sqlite_driver.php index 9c611f2fd..3a986d0a8 100644 --- a/system/database/drivers/sqlite/sqlite_driver.php +++ b/system/database/drivers/sqlite/sqlite_driver.php @@ -365,47 +365,6 @@ class CI_DB_sqlite_driver extends CI_DB { // -------------------------------------------------------------------- - /** - * Escape the SQL Identifiers - * - * This function escapes column and table names - * - * @param string - * @return string - */ - public function _escape_identifiers($item) - { - if ($this->_escape_char == '') - { - return $item; - } - - foreach ($this->_reserved_identifiers as $id) - { - if (strpos($item, '.'.$id) !== FALSE) - { - $str = $this->_escape_char. 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); - } - } - - 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; - } - - // remove duplicates if the user already included the escape - return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str); - } - - // -------------------------------------------------------------------- - /** * From Tables * -- cgit v1.2.3-24-g4f1b From c01d31685ad365c6bf3e833c03d7f8a3402c0ec7 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 9 Apr 2012 12:55:11 +0300 Subject: Added a default _delete() method to CI_DB_active_record --- system/database/drivers/sqlite/sqlite_driver.php | 33 ------------------------ 1 file changed, 33 deletions(-) (limited to 'system/database/drivers/sqlite/sqlite_driver.php') diff --git a/system/database/drivers/sqlite/sqlite_driver.php b/system/database/drivers/sqlite/sqlite_driver.php index 3a986d0a8..5021deb63 100644 --- a/system/database/drivers/sqlite/sqlite_driver.php +++ b/system/database/drivers/sqlite/sqlite_driver.php @@ -421,39 +421,6 @@ class CI_DB_sqlite_driver extends CI_DB { // -------------------------------------------------------------------- - /** - * Delete statement - * - * Generates a platform-specific delete string from the supplied data - * - * @param string the table name - * @param array the where clause - * @param string the limit clause - * @return string - */ - 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); - } - - $limit = ( ! $limit) ? '' : ' LIMIT '.$limit; - - return "DELETE FROM ".$table.$conditions.$limit; - } - - // -------------------------------------------------------------------- - /** * Limit string * -- cgit v1.2.3-24-g4f1b