summaryrefslogtreecommitdiffstats
path: root/system/database/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'system/database/drivers')
-rw-r--r--system/database/drivers/sqlite/sqlite_driver.php94
-rw-r--r--system/database/drivers/sqlite/sqlite_forge.php19
-rw-r--r--system/database/drivers/sqlite/sqlite_result.php25
-rw-r--r--system/database/drivers/sqlite/sqlite_utility.php2
4 files changed, 50 insertions, 90 deletions
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
diff --git a/system/database/drivers/sqlite/sqlite_forge.php b/system/database/drivers/sqlite/sqlite_forge.php
index 7fc531463..595d41968 100644
--- a/system/database/drivers/sqlite/sqlite_forge.php
+++ b/system/database/drivers/sqlite/sqlite_forge.php
@@ -43,7 +43,7 @@ class CI_DB_sqlite_forge extends CI_DB_forge {
* @param string the database name
* @return bool
*/
- function _create_database()
+ public function _create_database()
{
// In SQLite, a database is created when you connect to the database.
// We'll return TRUE so that an error isn't generated
@@ -55,11 +55,10 @@ class CI_DB_sqlite_forge extends CI_DB_forge {
/**
* Drop database
*
- * @access private
* @param string the database name
* @return bool
*/
- function _drop_database($name)
+ protected function _drop_database($name)
{
if ( ! @file_exists($this->db->database) OR ! @unlink($this->db->database))
{
@@ -76,7 +75,6 @@ class CI_DB_sqlite_forge extends CI_DB_forge {
/**
* Create Table
*
- * @access private
* @param string the table name
* @param array the fields
* @param mixed primary key(s)
@@ -84,7 +82,7 @@ class CI_DB_sqlite_forge extends CI_DB_forge {
* @param boolean should 'IF NOT EXISTS' be added to the SQL
* @return bool
*/
- function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists)
+ protected function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists)
{
$sql = 'CREATE TABLE ';
@@ -186,10 +184,9 @@ class CI_DB_sqlite_forge extends CI_DB_forge {
*
* Unsupported feature in SQLite
*
- * @access private
* @return bool
*/
- function _drop_table($table)
+ protected function _drop_table($table)
{
if ($this->db->db_debug)
{
@@ -206,7 +203,6 @@ class CI_DB_sqlite_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
@@ -216,7 +212,7 @@ class CI_DB_sqlite_forge extends CI_DB_forge {
* @param string the field after which we should add the new field
* @return object
*/
- function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '')
+ protected 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);
@@ -261,12 +257,11 @@ class CI_DB_sqlite_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)
+ protected 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);
}
@@ -274,4 +269,4 @@ class CI_DB_sqlite_forge extends CI_DB_forge {
}
/* End of file sqlite_forge.php */
-/* Location: ./system/database/drivers/sqlite/sqlite_forge.php */
+/* Location: ./system/database/drivers/sqlite/sqlite_forge.php */ \ No newline at end of file
diff --git a/system/database/drivers/sqlite/sqlite_result.php b/system/database/drivers/sqlite/sqlite_result.php
index ac2235cbc..beb4db6cd 100644
--- a/system/database/drivers/sqlite/sqlite_result.php
+++ b/system/database/drivers/sqlite/sqlite_result.php
@@ -41,10 +41,9 @@ class CI_DB_sqlite_result extends CI_DB_result {
/**
* Number of rows in the result set
*
- * @access public
* @return integer
*/
- function num_rows()
+ public function num_rows()
{
return @sqlite_num_rows($this->result_id);
}
@@ -54,10 +53,9 @@ class CI_DB_sqlite_result extends CI_DB_result {
/**
* Number of fields in the result set
*
- * @access public
* @return integer
*/
- function num_fields()
+ public function num_fields()
{
return @sqlite_num_fields($this->result_id);
}
@@ -69,10 +67,9 @@ class CI_DB_sqlite_result extends CI_DB_result {
*
* Generates an array of column names
*
- * @access public
* @return array
*/
- function list_fields()
+ public function list_fields()
{
$field_names = array();
for ($i = 0; $i < $this->num_fields(); $i++)
@@ -90,10 +87,9 @@ class CI_DB_sqlite_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();
for ($i = 0; $i < $this->num_fields(); $i++)
@@ -118,7 +114,7 @@ class CI_DB_sqlite_result extends CI_DB_result {
*
* @return null
*/
- function free_result()
+ public function free_result()
{
// Not implemented in SQLite
}
@@ -132,10 +128,9 @@ class CI_DB_sqlite_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 sqlite_seek($this->result_id, $n);
}
@@ -147,10 +142,9 @@ class CI_DB_sqlite_result extends CI_DB_result {
*
* Returns the result set as an array
*
- * @access private
* @return array
*/
- function _fetch_assoc()
+ protected function _fetch_assoc()
{
return sqlite_fetch_array($this->result_id);
}
@@ -162,10 +156,9 @@ class CI_DB_sqlite_result extends CI_DB_result {
*
* Returns the result set as an object
*
- * @access private
* @return object
*/
- function _fetch_object()
+ protected function _fetch_object()
{
if (function_exists('sqlite_fetch_object'))
{
@@ -183,9 +176,7 @@ class CI_DB_sqlite_result extends CI_DB_result {
}
}
}
-
}
-
/* End of file sqlite_result.php */
/* Location: ./system/database/drivers/sqlite/sqlite_result.php */ \ No newline at end of file
diff --git a/system/database/drivers/sqlite/sqlite_utility.php b/system/database/drivers/sqlite/sqlite_utility.php
index 9f9ddca44..c07004c54 100644
--- a/system/database/drivers/sqlite/sqlite_utility.php
+++ b/system/database/drivers/sqlite/sqlite_utility.php
@@ -94,4 +94,4 @@ class CI_DB_sqlite_utility extends CI_DB_utility {
}
/* End of file sqlite_utility.php */
-/* Location: ./system/database/drivers/sqlite/sqlite_utility.php */
+/* Location: ./system/database/drivers/sqlite/sqlite_utility.php */ \ No newline at end of file