summaryrefslogtreecommitdiffstats
path: root/system/database
diff options
context:
space:
mode:
Diffstat (limited to 'system/database')
-rw-r--r--system/database/DB.php7
-rw-r--r--system/database/DB_driver.php101
-rw-r--r--system/database/DB_forge.php36
-rw-r--r--system/database/DB_query_builder.php148
-rw-r--r--system/database/DB_utility.php14
-rw-r--r--system/database/drivers/cubrid/index.html2
-rw-r--r--system/database/drivers/ibase/index.html2
-rw-r--r--system/database/drivers/index.html2
-rw-r--r--system/database/drivers/mssql/index.html2
-rw-r--r--system/database/drivers/mssql/mssql_driver.php14
-rw-r--r--system/database/drivers/mysql/index.html2
-rw-r--r--system/database/drivers/mysql/mysql_driver.php57
-rw-r--r--system/database/drivers/mysqli/index.html2
-rw-r--r--system/database/drivers/mysqli/mysqli_driver.php20
-rw-r--r--system/database/drivers/oci8/index.html2
-rw-r--r--system/database/drivers/odbc/index.html2
-rw-r--r--system/database/drivers/pdo/index.html2
-rw-r--r--system/database/drivers/pdo/subdrivers/index.html2
-rw-r--r--system/database/drivers/postgre/index.html2
-rw-r--r--system/database/drivers/postgre/postgre_driver.php22
-rw-r--r--system/database/drivers/sqlite/index.html11
-rw-r--r--system/database/drivers/sqlite/sqlite_driver.php330
-rw-r--r--system/database/drivers/sqlite/sqlite_forge.php205
-rw-r--r--system/database/drivers/sqlite/sqlite_result.php164
-rw-r--r--system/database/drivers/sqlite/sqlite_utility.php61
-rw-r--r--system/database/drivers/sqlite3/index.html2
-rw-r--r--system/database/drivers/sqlsrv/index.html2
-rw-r--r--system/database/index.html2
28 files changed, 220 insertions, 998 deletions
diff --git a/system/database/DB.php b/system/database/DB.php
index f9ed0be76..c42bb6b91 100644
--- a/system/database/DB.php
+++ b/system/database/DB.php
@@ -82,7 +82,7 @@ function &DB($params = '', $query_builder_override = NULL)
}
}
- if ( ! isset($db) OR count($db) === 0)
+ if (empty($db))
{
show_error('No database connection settings were found in the database config file.');
}
@@ -192,10 +192,13 @@ function &DB($params = '', $query_builder_override = NULL)
// Load the DB driver
$driver_file = BASEPATH.'database/drivers/'.$params['dbdriver'].'/'.$params['dbdriver'].'_driver.php';
-
file_exists($driver_file) OR show_error('Invalid DB driver');
require_once($driver_file);
+ // Load the result classes as well
+ require_once(BASEPATH.'database/DB_result.php');
+ require_once(BASEPATH.'database/drivers/'.$params['dbdriver'].'/'.$params['dbdriver'].'_result.php');
+
// Instantiate the DB adapter
$driver = 'CI_DB_'.$params['dbdriver'].'_driver';
$DB = new $driver($params);
diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php
index 6e1d8d11e..a213d5cba 100644
--- a/system/database/DB_driver.php
+++ b/system/database/DB_driver.php
@@ -380,7 +380,8 @@ abstract class CI_DB_driver {
/**
* Initialize Database Settings
*
- * @return bool
+ * @return void
+ * @throws RuntimeException In case of failure
*/
public function initialize()
{
@@ -392,7 +393,7 @@ abstract class CI_DB_driver {
*/
if ($this->conn_id)
{
- return TRUE;
+ return;
}
// ----------------------------------------------------------------
@@ -429,19 +430,9 @@ abstract class CI_DB_driver {
// We still don't have a connection?
if ( ! $this->conn_id)
{
- log_message('error', 'Unable to connect to the database');
-
- if ($this->db_debug)
- {
- $this->display_error('db_unable_to_connect');
- }
-
- return FALSE;
+ throw new RuntimeException('Unable to connect to the database.');
}
}
-
- // Now we set the character set and that's all
- return $this->db_set_charset($this->char_set);
}
// --------------------------------------------------------------------
@@ -517,31 +508,6 @@ abstract class CI_DB_driver {
// --------------------------------------------------------------------
/**
- * Set client character set
- *
- * @param string
- * @return bool
- */
- public function db_set_charset($charset)
- {
- if (method_exists($this, '_db_set_charset') && ! $this->_db_set_charset($charset))
- {
- log_message('error', 'Unable to set database connection charset: '.$charset);
-
- if ($this->db_debug)
- {
- $this->display_error('db_unable_to_set_charset', $charset);
- }
-
- return FALSE;
- }
-
- return TRUE;
- }
-
- // --------------------------------------------------------------------
-
- /**
* The name of the platform in use (mysql, mssql, etc...)
*
* @return string
@@ -634,7 +600,6 @@ abstract class CI_DB_driver {
// cached query if it exists
if ($this->cache_on === TRUE && $return_object === TRUE && $this->_cache_init())
{
- $this->load_rdriver();
if (FALSE !== ($cache = $this->CACHE->read($sql)))
{
return $cache;
@@ -718,9 +683,9 @@ abstract class CI_DB_driver {
return TRUE;
}
- // Load and instantiate the result driver
- $driver = $this->load_rdriver();
- $RES = new $driver($this);
+ // Instantiate the driver-specific result class
+ $driver = 'CI_DB_'.$this->dbdriver.'_result';
+ $RES = new $driver($this);
// Is query caching enabled? If so, we'll serialize the
// result object and save it to a cache file.
@@ -750,26 +715,6 @@ abstract class CI_DB_driver {
// --------------------------------------------------------------------
/**
- * Load the result drivers
- *
- * @return string the name of the result class
- */
- public function load_rdriver()
- {
- $driver = 'CI_DB_'.$this->dbdriver.'_result';
-
- if ( ! class_exists($driver, FALSE))
- {
- require_once(BASEPATH.'database/DB_result.php');
- require_once(BASEPATH.'database/drivers/'.$this->dbdriver.'/'.$this->dbdriver.'_result.php');
- }
-
- return $driver;
- }
-
- // --------------------------------------------------------------------
-
- /**
* Simple Query
* This is a simplified version of the query() function. Internally
* we only use it when running transaction commands since they do
@@ -780,14 +725,7 @@ abstract class CI_DB_driver {
*/
public function simple_query($sql)
{
- if ( ! $this->conn_id)
- {
- if ( ! $this->initialize())
- {
- return FALSE;
- }
- }
-
+ empty($this->conn_id) && $this->initialize();
return $this->_execute($sql);
}
@@ -1389,10 +1327,11 @@ abstract class CI_DB_driver {
*
* This function escapes column and table names
*
- * @param mixed
+ * @param mixed $item Identifier to escape
+ * @param bool $split Whether to split identifiers when a dot is encountered
* @return mixed
*/
- public function escape_identifiers($item)
+ public function escape_identifiers($item, $split = TRUE)
{
if ($this->_escape_char === '' OR empty($item) OR in_array($item, $this->_reserved_identifiers))
{
@@ -1413,22 +1352,22 @@ abstract class CI_DB_driver {
return $item;
}
- static $preg_ec = array();
+ static $preg_ec;
if (empty($preg_ec))
{
if (is_array($this->_escape_char))
{
$preg_ec = array(
- preg_quote($this->_escape_char[0], '/'),
- preg_quote($this->_escape_char[1], '/'),
+ preg_quote($this->_escape_char[0]),
+ preg_quote($this->_escape_char[1]),
$this->_escape_char[0],
$this->_escape_char[1]
);
}
else
{
- $preg_ec[0] = $preg_ec[1] = preg_quote($this->_escape_char, '/');
+ $preg_ec[0] = $preg_ec[1] = preg_quote($this->_escape_char);
$preg_ec[2] = $preg_ec[3] = $this->_escape_char;
}
}
@@ -1437,11 +1376,13 @@ abstract class CI_DB_driver {
{
if (strpos($item, '.'.$id) !== FALSE)
{
- return preg_replace('/'.$preg_ec[0].'?([^'.$preg_ec[1].'\.]+)'.$preg_ec[1].'?\./i', $preg_ec[2].'$1'.$preg_ec[3].'.', $item);
+ return preg_replace('#'.$preg_ec[0].'?([^'.$preg_ec[1].'\.]+)'.$preg_ec[1].'?\.#i', $preg_ec[2].'$1'.$preg_ec[3].'.', $item);
}
}
- return preg_replace('/'.$preg_ec[0].'?([^'.$preg_ec[1].'\.]+)'.$preg_ec[1].'?(\.)?/i', $preg_ec[2].'$1'.$preg_ec[3].'$2', $item);
+ $dot = ($split !== FALSE) ? '\.' : '';
+
+ return preg_replace('#'.$preg_ec[0].'?([^'.$preg_ec[1].$dot.']+)'.$preg_ec[1].'?(\.)?#i', $preg_ec[2].'$1'.$preg_ec[3].'$2', $item);
}
// --------------------------------------------------------------------
@@ -1855,14 +1796,14 @@ abstract class CI_DB_driver {
if ($offset = strripos($item, ' AS '))
{
$alias = ($protect_identifiers)
- ? substr($item, $offset, 4).$this->escape_identifiers(substr($item, $offset + 4))
+ ? substr($item, $offset, 4).$this->escape_identifiers(substr($item, $offset + 4), FALSE)
: substr($item, $offset);
$item = substr($item, 0, $offset);
}
elseif ($offset = strrpos($item, ' '))
{
$alias = ($protect_identifiers)
- ? ' '.$this->escape_identifiers(substr($item, $offset + 1))
+ ? ' '.$this->escape_identifiers(substr($item, $offset + 1), FALSE)
: substr($item, $offset);
$item = substr($item, 0, $offset);
}
diff --git a/system/database/DB_forge.php b/system/database/DB_forge.php
index 7c31bd3c3..ce9b30d82 100644
--- a/system/database/DB_forge.php
+++ b/system/database/DB_forge.php
@@ -895,21 +895,33 @@ abstract class CI_DB_forge {
return;
}
- if (array_key_exists('DEFAULT', $attributes))
+ if ( ! array_key_exists('DEFAULT', $attributes))
{
- if ($attributes['DEFAULT'] === NULL)
- {
- $field['default'] = empty($this->_null) ? '' : $this->_default.$this->_null;
+ return;
+ }
- // Override the NULL attribute if that's our default
- $attributes['NULL'] = TRUE;
- $field['null'] = empty($this->_null) ? '' : ' '.$this->_null;
- }
- else
- {
- $field['default'] = $this->_default.$this->db->escape($attributes['DEFAULT']);
- }
+ if ($attributes['DEFAULT'] === NULL)
+ {
+ $field['default'] = empty($this->_null) ? '' : $this->_default.$this->_null;
+
+ // Override the NULL attribute if that's our default
+ $attributes['NULL'] = TRUE;
+ $field['null'] = empty($this->_null) ? '' : ' '.$this->_null;
+ return;
}
+
+ // White-list CURRENT_TIMESTAMP & similar (e.g. Oracle has stuff like SYSTIMESTAMP) defaults for date/time fields
+ if (
+ isset($attributes['TYPE'])
+ && (stripos($attributes['TYPE'], 'time') !== FALSE OR stripos($attributes['TYPE'], 'date') !== FALSE)
+ && (stripos($attributes['DEFAULT'], 'time') !== FALSE OR stripos($attributes['DEFAULT'], 'date') !== FALSE)
+ )
+ {
+ $field['default'] = $this->_default.$attributes['DEFAULT'];
+ return;
+ }
+
+ $field['default'] = $this->_default.$this->db->escape($attributes['DEFAULT']);
}
// --------------------------------------------------------------------
diff --git a/system/database/DB_query_builder.php b/system/database/DB_query_builder.php
index 52538c695..5480ed44f 100644
--- a/system/database/DB_query_builder.php
+++ b/system/database/DB_query_builder.php
@@ -525,19 +525,8 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
*/
public function join($table, $cond, $type = '', $escape = NULL)
{
- if ($type !== '')
- {
- $type = strtoupper(trim($type));
-
- if ( ! in_array($type, array('LEFT', 'RIGHT', 'OUTER', 'INNER', 'LEFT OUTER', 'RIGHT OUTER', 'FULL OUTER', 'FULL'), TRUE))
- {
- $type = '';
- }
- else
- {
- $type .= ' ';
- }
- }
+ $type = trim(strtoupper($type).' JOIN');
+ preg_match('#^(NATURAL\s+)?((LEFT|RIGHT|FULL)\s+)?((INNER|OUTER)\s+)?JOIN$#', $type) OR $type = 'JOIN';
// Extract any aliases that might exist. We use this information
// in the protect_identifiers to know whether to add a table prefix
@@ -545,7 +534,11 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
is_bool($escape) OR $escape = $this->_protect_identifiers;
- if ( ! $this->_has_operator($cond))
+ if (strpos($type, 'NATURAL') === 0)
+ {
+ $cond = '';
+ }
+ elseif ( ! $this->_has_operator($cond))
{
$cond = ' USING ('.($escape ? $this->escape_identifiers($cond) : $cond).')';
}
@@ -594,7 +587,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
}
// Assemble the JOIN statement
- $this->qb_join[] = $join = $type.'JOIN '.$table.$cond;
+ $this->qb_join[] = $join = $type.' '.$table.$cond;
if ($this->qb_caching === TRUE)
{
@@ -724,9 +717,9 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
* @param bool $escape
* @return CI_DB_query_builder
*/
- public function where_in($key = NULL, $values = NULL, $escape = NULL)
+ public function where_in($key, array $values, $escape = NULL)
{
- return $this->_where_in($key, $values, FALSE, 'AND ', $escape);
+ return $this->_wh_in('qb_where', $key, $values, FALSE, 'AND ', $escape);
}
// --------------------------------------------------------------------
@@ -742,9 +735,9 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
* @param bool $escape
* @return CI_DB_query_builder
*/
- public function or_where_in($key = NULL, $values = NULL, $escape = NULL)
+ public function or_where_in($key, array $values, $escape = NULL)
{
- return $this->_where_in($key, $values, FALSE, 'OR ', $escape);
+ return $this->_wh_in('qb_where', $key, $values, FALSE, 'OR ', $escape);
}
// --------------------------------------------------------------------
@@ -760,9 +753,9 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
* @param bool $escape
* @return CI_DB_query_builder
*/
- public function where_not_in($key = NULL, $values = NULL, $escape = NULL)
+ public function where_not_in($key, array $values, $escape = NULL)
{
- return $this->_where_in($key, $values, TRUE, 'AND ', $escape);
+ return $this->_wh_in('qb_where', $key, $values, TRUE, 'AND ', $escape);
}
// --------------------------------------------------------------------
@@ -778,21 +771,98 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
* @param bool $escape
* @return CI_DB_query_builder
*/
- public function or_where_not_in($key = NULL, $values = NULL, $escape = NULL)
+ public function or_where_not_in($key, array $values, $escape = NULL)
+ {
+ return $this->_wh_in('qb_where', $key, $values, TRUE, 'OR ', $escape);
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * HAVING IN
+ *
+ * Generates a HAVING field IN('item', 'item') SQL query,
+ * joined with 'AND' if appropriate.
+ *
+ * @param string $key The field to search
+ * @param array $values The values searched on
+ * @param bool $escape
+ * @return CI_DB_query_builder
+ */
+ public function having_in($key, array $values, $escape = NULL)
+ {
+ return $this->_wh_in('qb_having', $key, $values, FALSE, 'AND ', $escape);
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * OR HAVING IN
+ *
+ * Generates a HAVING field IN('item', 'item') SQL query,
+ * joined with 'OR' if appropriate.
+ *
+ * @param string $key The field to search
+ * @param array $values The values searched on
+ * @param bool $escape
+ * @return CI_DB_query_builder
+ */
+ public function or_having_in($key, array $values, $escape = NULL)
+ {
+ return $this->_wh_in('qb_having', $key, $values, FALSE, 'OR ', $escape);
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * HAVING NOT IN
+ *
+ * Generates a HAVING field NOT IN('item', 'item') SQL query,
+ * joined with 'AND' if appropriate.
+ *
+ * @param string $key The field to search
+ * @param array $values The values searched on
+ * @param bool $escape
+ * @return CI_DB_query_builder
+ */
+ public function having_not_in($key, array $values, $escape = NULL)
{
- return $this->_where_in($key, $values, TRUE, 'OR ', $escape);
+ return $this->_wh_in('qb_having', $key, $values, TRUE, 'AND ', $escape);
}
// --------------------------------------------------------------------
/**
- * Internal WHERE IN
+ * OR HAVING NOT IN
+ *
+ * Generates a HAVING field NOT IN('item', 'item') SQL query,
+ * joined with 'OR' if appropriate.
+ *
+ * @param string $key The field to search
+ * @param array $values The values searched on
+ * @param bool $escape
+ * @return CI_DB_query_builder
+ */
+ public function or_having_not_in($key, array $values, $escape = NULL)
+ {
+ return $this->_wh_in('qb_having', $key, $values, TRUE, 'OR ', $escape);
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Internal WHERE/HAVING IN
*
* @used-by where_in()
* @used-by or_where_in()
* @used-by where_not_in()
* @used-by or_where_not_in()
+ * @used-by having_in()
+ * @used-by or_having_in()
+ * @used-by having_not_in()
+ * @used-by or_having_not_in()
*
+ * @param string $qb_key 'qb_where' or 'qb_having'
* @param string $key The field to search
* @param array $values The values searched on
* @param bool $not If the statement would be IN or NOT IN
@@ -800,16 +870,18 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
* @param bool $escape
* @return CI_DB_query_builder
*/
- protected function _where_in($key = NULL, $values = NULL, $not = FALSE, $type = 'AND ', $escape = NULL)
+ protected function _wh_in($qb_key, $key, array $values, $not = FALSE, $type = 'AND ', $escape = NULL)
{
- if ($key === NULL OR $values === NULL)
+ $qb_cache_key = ($qb_key === 'qb_having') ? 'qb_cache_having' : 'qb_cache_where';
+
+ if (empty($key) OR ! is_string($key))
{
- return $this;
+ throw new InvalidArgumentException(sprintf('%s() expects $key to be a non-empty string', debug_backtrace(0, 2)[1]['function']));
}
- if ( ! is_array($values))
+ if (empty($values))
{
- $values = array($values);
+ throw new InvalidArgumentException(sprintf('%s() expects $values to be a non-empty array', debug_backtrace(0, 2)[1]['function']));
}
is_bool($escape) OR $escape = $this->_protect_identifiers;
@@ -818,32 +890,32 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
if ($escape === TRUE)
{
- $where_in = array();
+ $wh_in = array();
foreach ($values as $value)
{
- $where_in[] = $this->escape($value);
+ $wh_in[] = $this->escape($value);
}
}
else
{
- $where_in = array_values($values);
+ $wh_in = array_values($values);
}
- $prefix = (count($this->qb_where) === 0 && count($this->qb_cache_where) === 0)
+ $prefix = (count($this->$qb_key) === 0 && count($this->$qb_cache_key) === 0)
? $this->_group_get_type('')
: $this->_group_get_type($type);
- $where_in = array(
- 'condition' => $prefix.$key.$not.' IN('.implode(', ', $where_in).')',
+ $wh_in = array(
+ 'condition' => $prefix.$key.$not.' IN('.implode(', ', $wh_in).')',
'value' => NULL,
'escape' => $escape
);
- $this->qb_where[] = $where_in;
+ $this->{$qb_key}[] = $wh_in;
if ($this->qb_caching === TRUE)
{
- $this->qb_cache_where[] = $where_in;
- $this->qb_cache_exists[] = 'where';
+ $this->{$qb_cache_key}[] = $wh_in;
+ $this->qb_cache_exists[] = substr($qb_key, 3);
}
return $this;
diff --git a/system/database/DB_utility.php b/system/database/DB_utility.php
index a843754b4..a1450f099 100644
--- a/system/database/DB_utility.php
+++ b/system/database/DB_utility.php
@@ -235,13 +235,8 @@ abstract class CI_DB_utility {
* @param string $enclosure Enclosure (default: ")
* @return string
*/
- public function csv_from_result($query, $delim = ',', $newline = "\n", $enclosure = '"')
+ public function csv_from_result(CI_DB_result $query, $delim = ',', $newline = "\n", $enclosure = '"')
{
- if ( ! is_object($query) OR ! method_exists($query, 'list_fields'))
- {
- show_error('You must submit a valid result object');
- }
-
$out = '';
// First generate the headings from the table column names
foreach ($query->list_fields() as $name)
@@ -274,13 +269,8 @@ abstract class CI_DB_utility {
* @param array $params Any preferences
* @return string
*/
- public function xml_from_result($query, $params = array())
+ public function xml_from_result(CI_DB_result $query, $params = array())
{
- if ( ! is_object($query) OR ! method_exists($query, 'list_fields'))
- {
- show_error('You must submit a valid result object');
- }
-
// Set our default values
foreach (array('root' => 'root', 'element' => 'element', 'newline' => "\n", 'tab' => "\t") as $key => $val)
{
diff --git a/system/database/drivers/cubrid/index.html b/system/database/drivers/cubrid/index.html
index b702fbc39..bcb7cae34 100644
--- a/system/database/drivers/cubrid/index.html
+++ b/system/database/drivers/cubrid/index.html
@@ -1,5 +1,5 @@
<!DOCTYPE html>
-<html>
+<html lang="en">
<head>
<title>403 Forbidden</title>
</head>
diff --git a/system/database/drivers/ibase/index.html b/system/database/drivers/ibase/index.html
index b702fbc39..bcb7cae34 100644
--- a/system/database/drivers/ibase/index.html
+++ b/system/database/drivers/ibase/index.html
@@ -1,5 +1,5 @@
<!DOCTYPE html>
-<html>
+<html lang="en">
<head>
<title>403 Forbidden</title>
</head>
diff --git a/system/database/drivers/index.html b/system/database/drivers/index.html
index b702fbc39..bcb7cae34 100644
--- a/system/database/drivers/index.html
+++ b/system/database/drivers/index.html
@@ -1,5 +1,5 @@
<!DOCTYPE html>
-<html>
+<html lang="en">
<head>
<title>403 Forbidden</title>
</head>
diff --git a/system/database/drivers/mssql/index.html b/system/database/drivers/mssql/index.html
index b702fbc39..bcb7cae34 100644
--- a/system/database/drivers/mssql/index.html
+++ b/system/database/drivers/mssql/index.html
@@ -1,5 +1,5 @@
<!DOCTYPE html>
-<html>
+<html lang="en">
<head>
<title>403 Forbidden</title>
</head>
diff --git a/system/database/drivers/mssql/mssql_driver.php b/system/database/drivers/mssql/mssql_driver.php
index fbb7e1032..a20b01237 100644
--- a/system/database/drivers/mssql/mssql_driver.php
+++ b/system/database/drivers/mssql/mssql_driver.php
@@ -108,6 +108,7 @@ class CI_DB_mssql_driver extends CI_DB {
*/
public function db_connect($persistent = FALSE)
{
+ ini_set('mssql.charset', $this->char_set);
$this->conn_id = ($persistent)
? mssql_pconnect($this->hostname, $this->username, $this->password)
: mssql_connect($this->hostname, $this->username, $this->password);
@@ -249,19 +250,6 @@ class CI_DB_mssql_driver extends CI_DB {
// --------------------------------------------------------------------
/**
- * Set client character set
- *
- * @param string $charset
- * @return bool
- */
- protected function _db_set_charset($charset)
- {
- return (ini_set('mssql.charset', $charset) !== FALSE);
- }
-
- // --------------------------------------------------------------------
-
- /**
* Version number query string
*
* @return string
diff --git a/system/database/drivers/mysql/index.html b/system/database/drivers/mysql/index.html
index b702fbc39..bcb7cae34 100644
--- a/system/database/drivers/mysql/index.html
+++ b/system/database/drivers/mysql/index.html
@@ -1,5 +1,5 @@
<!DOCTYPE html>
-<html>
+<html lang="en">
<head>
<title>403 Forbidden</title>
</head>
diff --git a/system/database/drivers/mysql/mysql_driver.php b/system/database/drivers/mysql/mysql_driver.php
index e5d16bd88..61337cdd3 100644
--- a/system/database/drivers/mysql/mysql_driver.php
+++ b/system/database/drivers/mysql/mysql_driver.php
@@ -147,29 +147,41 @@ class CI_DB_mysql_driver extends CI_DB {
: FALSE;
}
- if (isset($this->stricton) && is_resource($this->conn_id))
+ if (is_resource($this->conn_id))
{
- if ($this->stricton)
+ if ( ! mysql_set_charset($this->char_set, $this->conn_id))
{
- $this->simple_query('SET SESSION sql_mode = CONCAT(@@sql_mode, ",", "STRICT_ALL_TABLES")');
+ log_message('error', "Database: Unable to set the configured connection charset ('{$this->char_set}').");
+ $this->close();
+ return ($this->db->debug) ? $this->display_error('db_unable_to_set_charset', $this->char_set) : FALSE;
}
- else
+
+ if (isset($this->stricton))
{
- $this->simple_query(
- 'SET SESSION sql_mode =
- REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(
- @@sql_mode,
- "STRICT_ALL_TABLES,", ""),
- ",STRICT_ALL_TABLES", ""),
- "STRICT_ALL_TABLES", ""),
- "STRICT_TRANS_TABLES,", ""),
- ",STRICT_TRANS_TABLES", ""),
- "STRICT_TRANS_TABLES", "")'
- );
+ if ($this->stricton)
+ {
+ $this->simple_query('SET SESSION sql_mode = CONCAT(@@sql_mode, ",", "STRICT_ALL_TABLES")');
+ }
+ else
+ {
+ $this->simple_query(
+ 'SET SESSION sql_mode =
+ REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(
+ @@sql_mode,
+ "STRICT_ALL_TABLES,", ""),
+ ",STRICT_ALL_TABLES", ""),
+ "STRICT_ALL_TABLES", ""),
+ "STRICT_TRANS_TABLES,", ""),
+ ",STRICT_TRANS_TABLES", ""),
+ "STRICT_TRANS_TABLES", "")'
+ );
+ }
}
+
+ return $this->conn_id;
}
- return $this->conn_id;
+ return FALSE;
}
// --------------------------------------------------------------------
@@ -218,19 +230,6 @@ class CI_DB_mysql_driver extends CI_DB {
// --------------------------------------------------------------------
/**
- * Set client character set
- *
- * @param string $charset
- * @return bool
- */
- protected function _db_set_charset($charset)
- {
- return mysql_set_charset($charset, $this->conn_id);
- }
-
- // --------------------------------------------------------------------
-
- /**
* Database version number
*
* @return string
diff --git a/system/database/drivers/mysqli/index.html b/system/database/drivers/mysqli/index.html
index b702fbc39..bcb7cae34 100644
--- a/system/database/drivers/mysqli/index.html
+++ b/system/database/drivers/mysqli/index.html
@@ -1,5 +1,5 @@
<!DOCTYPE html>
-<html>
+<html lang="en">
<head>
<title>403 Forbidden</title>
</head>
diff --git a/system/database/drivers/mysqli/mysqli_driver.php b/system/database/drivers/mysqli/mysqli_driver.php
index 3dea1dbc5..dc3d0cf48 100644
--- a/system/database/drivers/mysqli/mysqli_driver.php
+++ b/system/database/drivers/mysqli/mysqli_driver.php
@@ -222,6 +222,13 @@ class CI_DB_mysqli_driver extends CI_DB {
return ($this->db_debug) ? $this->display_error($message, '', TRUE) : FALSE;
}
+ if ( ! $this->_mysqli->set_charset($this->char_set))
+ {
+ log_message('error', "Database: Unable to set the configured connection charset ('{$this->char_set}').");
+ $this->_mysqli->close();
+ return ($this->db->db_debug) ? $this->display_error('db_unable_to_set_charset', $this->char_set) : FALSE;
+ }
+
return $this->_mysqli;
}
@@ -274,19 +281,6 @@ class CI_DB_mysqli_driver extends CI_DB {
// --------------------------------------------------------------------
/**
- * Set client character set
- *
- * @param string $charset
- * @return bool
- */
- protected function _db_set_charset($charset)
- {
- return $this->conn_id->set_charset($charset);
- }
-
- // --------------------------------------------------------------------
-
- /**
* Database version number
*
* @return string
diff --git a/system/database/drivers/oci8/index.html b/system/database/drivers/oci8/index.html
index b702fbc39..bcb7cae34 100644
--- a/system/database/drivers/oci8/index.html
+++ b/system/database/drivers/oci8/index.html
@@ -1,5 +1,5 @@
<!DOCTYPE html>
-<html>
+<html lang="en">
<head>
<title>403 Forbidden</title>
</head>
diff --git a/system/database/drivers/odbc/index.html b/system/database/drivers/odbc/index.html
index b702fbc39..bcb7cae34 100644
--- a/system/database/drivers/odbc/index.html
+++ b/system/database/drivers/odbc/index.html
@@ -1,5 +1,5 @@
<!DOCTYPE html>
-<html>
+<html lang="en">
<head>
<title>403 Forbidden</title>
</head>
diff --git a/system/database/drivers/pdo/index.html b/system/database/drivers/pdo/index.html
index b702fbc39..bcb7cae34 100644
--- a/system/database/drivers/pdo/index.html
+++ b/system/database/drivers/pdo/index.html
@@ -1,5 +1,5 @@
<!DOCTYPE html>
-<html>
+<html lang="en">
<head>
<title>403 Forbidden</title>
</head>
diff --git a/system/database/drivers/pdo/subdrivers/index.html b/system/database/drivers/pdo/subdrivers/index.html
index b702fbc39..bcb7cae34 100644
--- a/system/database/drivers/pdo/subdrivers/index.html
+++ b/system/database/drivers/pdo/subdrivers/index.html
@@ -1,5 +1,5 @@
<!DOCTYPE html>
-<html>
+<html lang="en">
<head>
<title>403 Forbidden</title>
</head>
diff --git a/system/database/drivers/postgre/index.html b/system/database/drivers/postgre/index.html
index b702fbc39..bcb7cae34 100644
--- a/system/database/drivers/postgre/index.html
+++ b/system/database/drivers/postgre/index.html
@@ -1,5 +1,5 @@
<!DOCTYPE html>
-<html>
+<html lang="en">
<head>
<title>403 Forbidden</title>
</head>
diff --git a/system/database/drivers/postgre/postgre_driver.php b/system/database/drivers/postgre/postgre_driver.php
index eb11a556a..22638f901 100644
--- a/system/database/drivers/postgre/postgre_driver.php
+++ b/system/database/drivers/postgre/postgre_driver.php
@@ -154,6 +154,13 @@ class CI_DB_postgre_driver extends CI_DB {
return FALSE;
}
+ if (pg_set_client_encoding($this->conn_id, $this->char_set) !== 0)
+ {
+ log_message('error', "Database: Unable to set the configured connection charset ('{$this->char_set}').");
+ pg_close($this->conn_id);
+ return ($this->db->db_debug) ? $this->display_error('db_unable_to_set_charset', $this->char_set) : FALSE;
+ }
+
empty($this->schema) OR $this->simple_query('SET search_path TO '.$this->schema.',public');
}
@@ -181,19 +188,6 @@ class CI_DB_postgre_driver extends CI_DB {
// --------------------------------------------------------------------
/**
- * Set client character set
- *
- * @param string $charset
- * @return bool
- */
- protected function _db_set_charset($charset)
- {
- return (pg_set_client_encoding($this->conn_id, $charset) === 0);
- }
-
- // --------------------------------------------------------------------
-
- /**
* Database version number
*
* @return string
@@ -312,7 +306,7 @@ class CI_DB_postgre_driver extends CI_DB {
*/
public function escape($str)
{
- if (is_php('5.4.4') && (is_string($str) OR (is_object($str) && method_exists($str, '__toString'))))
+ if (is_string($str) OR (is_object($str) && method_exists($str, '__toString')))
{
return pg_escape_literal($this->conn_id, $str);
}
diff --git a/system/database/drivers/sqlite/index.html b/system/database/drivers/sqlite/index.html
deleted file mode 100644
index b702fbc39..000000000
--- a/system/database/drivers/sqlite/index.html
+++ /dev/null
@@ -1,11 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
- <title>403 Forbidden</title>
-</head>
-<body>
-
-<p>Directory access is forbidden.</p>
-
-</body>
-</html>
diff --git a/system/database/drivers/sqlite/sqlite_driver.php b/system/database/drivers/sqlite/sqlite_driver.php
deleted file mode 100644
index 575ed2841..000000000
--- a/system/database/drivers/sqlite/sqlite_driver.php
+++ /dev/null
@@ -1,330 +0,0 @@
-<?php
-/**
- * CodeIgniter
- *
- * An open source application development framework for PHP
- *
- * This content is released under the MIT License (MIT)
- *
- * Copyright (c) 2014 - 2019, British Columbia Institute of Technology
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- *
- * @package CodeIgniter
- * @author EllisLab Dev Team
- * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
- * @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (http://bcit.ca/)
- * @license http://opensource.org/licenses/MIT MIT License
- * @link https://codeigniter.com
- * @since Version 1.3.0
- * @filesource
- */
-defined('BASEPATH') OR exit('No direct script access allowed');
-
-/**
- * SQLite Database Adapter Class
- *
- * Note: _DB is an extender class that the app controller
- * creates dynamically based on whether the query builder
- * class is being used or not.
- *
- * @package CodeIgniter
- * @subpackage Drivers
- * @category Database
- * @author EllisLab Dev Team
- * @link https://codeigniter.com/userguide3/database/
- */
-class CI_DB_sqlite_driver extends CI_DB {
-
- /**
- * Database driver
- *
- * @var string
- */
- public $dbdriver = 'sqlite';
-
- // --------------------------------------------------------------------
-
- /**
- * ORDER BY random keyword
- *
- * @var array
- */
- protected $_random_keyword = array('RANDOM()', 'RANDOM()');
-
- // --------------------------------------------------------------------
-
- /**
- * Non-persistent database connection
- *
- * @param bool $persistent
- * @return resource
- */
- public function db_connect($persistent = FALSE)
- {
- $error = NULL;
- $conn_id = ($persistent === TRUE)
- ? sqlite_popen($this->database, 0666, $error)
- : sqlite_open($this->database, 0666, $error);
-
- isset($error) && log_message('error', $error);
-
- return $conn_id;
- }
-
- // --------------------------------------------------------------------
-
- /**
- * Database version number
- *
- * @return string
- */
- public function version()
- {
- return isset($this->data_cache['version'])
- ? $this->data_cache['version']
- : $this->data_cache['version'] = sqlite_libversion();
- }
-
- // --------------------------------------------------------------------
-
- /**
- * Execute the query
- *
- * @param string $sql an SQL query
- * @return resource
- */
- protected function _execute($sql)
- {
- return $this->is_write_type($sql)
- ? sqlite_exec($this->conn_id, $sql)
- : sqlite_query($this->conn_id, $sql);
- }
-
- // --------------------------------------------------------------------
-
- /**
- * Begin Transaction
- *
- * @return bool
- */
- protected function _trans_begin()
- {
- return $this->simple_query('BEGIN TRANSACTION');
- }
-
- // --------------------------------------------------------------------
-
- /**
- * Commit Transaction
- *
- * @return bool
- */
- protected function _trans_commit()
- {
- return $this->simple_query('COMMIT');
- }
-
- // --------------------------------------------------------------------
-
- /**
- * Rollback Transaction
- *
- * @return bool
- */
- protected function _trans_rollback()
- {
- return $this->simple_query('ROLLBACK');
- }
-
- // --------------------------------------------------------------------
-
- /**
- * Platform-dependant string escape
- *
- * @param string
- * @return string
- */
- protected function _escape_str($str)
- {
- return sqlite_escape_string($str);
- }
-
- // --------------------------------------------------------------------
-
- /**
- * Affected Rows
- *
- * @return int
- */
- public function affected_rows()
- {
- return sqlite_changes($this->conn_id);
- }
-
- // --------------------------------------------------------------------
-
- /**
- * Insert ID
- *
- * @return int
- */
- public function insert_id()
- {
- return sqlite_last_insert_rowid($this->conn_id);
- }
-
- // --------------------------------------------------------------------
-
- /**
- * List table query
- *
- * Generates a platform-specific query string so that the table names can be fetched
- *
- * @param bool $prefix_limit
- * @return string
- */
- protected function _list_tables($prefix_limit = FALSE)
- {
- $sql = "SELECT name FROM sqlite_master WHERE type='table'";
-
- if ($prefix_limit !== FALSE && $this->dbprefix != '')
- {
- return $sql." AND 'name' LIKE '".$this->escape_like_str($this->dbprefix)."%' ".sprintf($this->_like_escape_str, $this->_like_escape_chr);
- }
-
- return $sql;
- }
-
- // --------------------------------------------------------------------
-
- /**
- * Show column query
- *
- * Generates a platform-specific query string so that the column names can be fetched
- *
- * @param string $table
- * @return bool
- */
- protected function _list_columns($table = '')
- {
- // Not supported
- return FALSE;
- }
-
- // --------------------------------------------------------------------
-
- /**
- * Returns an object with field data
- *
- * @param string $table
- * @return array
- */
- public function field_data($table)
- {
- if (($query = $this->query('PRAGMA TABLE_INFO('.$this->protect_identifiers($table, TRUE, NULL, FALSE).')')) === FALSE)
- {
- return FALSE;
- }
-
- $query = $query->result_array();
- if (empty($query))
- {
- return FALSE;
- }
-
- $retval = array();
- for ($i = 0, $c = count($query); $i < $c; $i++)
- {
- $retval[$i] = new stdClass();
- $retval[$i]->name = $query[$i]['name'];
- $retval[$i]->type = $query[$i]['type'];
- $retval[$i]->max_length = NULL;
- $retval[$i]->default = $query[$i]['dflt_value'];
- $retval[$i]->primary_key = isset($query[$i]['pk']) ? (int) $query[$i]['pk'] : 0;
- }
-
- return $retval;
- }
-
- // --------------------------------------------------------------------
-
- /**
- * Error
- *
- * Returns an array containing code and message of the last
- * database error that has occured.
- *
- * @return array
- */
- public function error()
- {
- $error = array('code' => sqlite_last_error($this->conn_id));
- $error['message'] = sqlite_error_string($error['code']);
- return $error;
- }
-
- // --------------------------------------------------------------------
-
- /**
- * Replace statement
- *
- * Generates a platform-specific replace string from the supplied data
- *
- * @param string $table Table name
- * @param array $keys INSERT keys
- * @param array $values INSERT values
- * @return string
- */
- protected function _replace($table, $keys, $values)
- {
- return 'INSERT OR '.parent::_replace($table, $keys, $values);
- }
-
- // --------------------------------------------------------------------
-
- /**
- * Truncate statement
- *
- * Generates a platform-specific truncate string from the supplied data
- *
- * If the database does not support the TRUNCATE statement,
- * then this function maps to 'DELETE FROM table'
- *
- * @param string $table
- * @return string
- */
- protected function _truncate($table)
- {
- return 'DELETE FROM '.$table;
- }
-
- // --------------------------------------------------------------------
-
- /**
- * Close DB Connection
- *
- * @return void
- */
- protected function _close()
- {
- sqlite_close($this->conn_id);
- }
-
-}
diff --git a/system/database/drivers/sqlite/sqlite_forge.php b/system/database/drivers/sqlite/sqlite_forge.php
deleted file mode 100644
index 118d77fd8..000000000
--- a/system/database/drivers/sqlite/sqlite_forge.php
+++ /dev/null
@@ -1,205 +0,0 @@
-<?php
-/**
- * CodeIgniter
- *
- * An open source application development framework for PHP
- *
- * This content is released under the MIT License (MIT)
- *
- * Copyright (c) 2014 - 2019, British Columbia Institute of Technology
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- *
- * @package CodeIgniter
- * @author EllisLab Dev Team
- * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
- * @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (http://bcit.ca/)
- * @license http://opensource.org/licenses/MIT MIT License
- * @link https://codeigniter.com
- * @since Version 1.3.0
- * @filesource
- */
-defined('BASEPATH') OR exit('No direct script access allowed');
-
-/**
- * SQLite Forge Class
- *
- * @category Database
- * @author EllisLab Dev Team
- * @link https://codeigniter.com/userguide3/database/
- */
-class CI_DB_sqlite_forge extends CI_DB_forge {
-
- /**
- * CREATE TABLE IF statement
- *
- * @var string
- */
- protected $_create_table_if = FALSE;
-
- /**
- * UNSIGNED support
- *
- * @var bool|array
- */
- protected $_unsigned = FALSE;
-
- /**
- * NULL value representation in CREATE/ALTER TABLE statements
- *
- * @var string
- */
- protected $_null = 'NULL';
-
- // --------------------------------------------------------------------
-
- /**
- * Create database
- *
- * @param string $db_name (ignored)
- * @return bool
- */
- public function create_database($db_name)
- {
- // In SQLite, a database is created when you connect to the database.
- // We'll return TRUE so that an error isn't generated
- return TRUE;
- }
-
- // --------------------------------------------------------------------
-
- /**
- * Drop database
- *
- * @param string $db_name (ignored)
- * @return bool
- */
- public function drop_database($db_name)
- {
- if ( ! file_exists($this->db->database) OR ! @unlink($this->db->database))
- {
- return ($this->db->db_debug) ? $this->db->display_error('db_unable_to_drop') : FALSE;
- }
- elseif ( ! empty($this->db->data_cache['db_names']))
- {
- $key = array_search(strtolower($this->db->database), array_map('strtolower', $this->db->data_cache['db_names']), TRUE);
- if ($key !== FALSE)
- {
- unset($this->db->data_cache['db_names'][$key]);
- }
- }
-
- return TRUE;
- }
-
- // --------------------------------------------------------------------
-
- /**
- * ALTER TABLE
- *
- * @todo implement drop_column(), modify_column()
- * @param string $alter_type ALTER type
- * @param string $table Table name
- * @param mixed $field Column definition
- * @return string|string[]
- */
- protected function _alter_table($alter_type, $table, $field)
- {
- if ($alter_type === 'DROP' OR $alter_type === 'CHANGE')
- {
- // drop_column():
- // BEGIN TRANSACTION;
- // CREATE TEMPORARY TABLE t1_backup(a,b);
- // INSERT INTO t1_backup SELECT a,b FROM t1;
- // DROP TABLE t1;
- // CREATE TABLE t1(a,b);
- // INSERT INTO t1 SELECT a,b FROM t1_backup;
- // DROP TABLE t1_backup;
- // COMMIT;
-
- return FALSE;
- }
-
- return parent::_alter_table($alter_type, $table, $field);
- }
-
- // --------------------------------------------------------------------
-
- /**
- * Process column
- *
- * @param array $field
- * @return string
- */
- protected function _process_column($field)
- {
- return $this->db->escape_identifiers($field['name'])
- .' '.$field['type']
- .$field['auto_increment']
- .$field['null']
- .$field['unique']
- .$field['default'];
- }
-
- // --------------------------------------------------------------------
-
- /**
- * Field attribute TYPE
- *
- * Performs a data type mapping between different databases.
- *
- * @param array &$attributes
- * @return void
- */
- protected function _attr_type(&$attributes)
- {
- switch (strtoupper($attributes['TYPE']))
- {
- case 'ENUM':
- case 'SET':
- $attributes['TYPE'] = 'TEXT';
- return;
- default: return;
- }
- }
-
- // --------------------------------------------------------------------
-
- /**
- * Field attribute AUTO_INCREMENT
- *
- * @param array &$attributes
- * @param array &$field
- * @return void
- */
- protected function _attr_auto_increment(&$attributes, &$field)
- {
- if ( ! empty($attributes['AUTO_INCREMENT']) && $attributes['AUTO_INCREMENT'] === TRUE && stripos($field['type'], 'int') !== FALSE)
- {
- $field['type'] = 'INTEGER PRIMARY KEY';
- $field['default'] = '';
- $field['null'] = '';
- $field['unique'] = '';
- $field['auto_increment'] = ' AUTOINCREMENT';
-
- $this->primary_keys = array();
- }
- }
-
-}
diff --git a/system/database/drivers/sqlite/sqlite_result.php b/system/database/drivers/sqlite/sqlite_result.php
deleted file mode 100644
index 170e1b565..000000000
--- a/system/database/drivers/sqlite/sqlite_result.php
+++ /dev/null
@@ -1,164 +0,0 @@
-<?php
-/**
- * CodeIgniter
- *
- * An open source application development framework for PHP
- *
- * This content is released under the MIT License (MIT)
- *
- * Copyright (c) 2014 - 2019, British Columbia Institute of Technology
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- *
- * @package CodeIgniter
- * @author EllisLab Dev Team
- * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
- * @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (http://bcit.ca/)
- * @license http://opensource.org/licenses/MIT MIT License
- * @link https://codeigniter.com
- * @since Version 1.3.0
- * @filesource
- */
-defined('BASEPATH') OR exit('No direct script access allowed');
-
-/**
- * SQLite Result Class
- *
- * This class extends the parent result class: CI_DB_result
- *
- * @category Database
- * @author EllisLab Dev Team
- * @link https://codeigniter.com/userguide3/database/
- */
-class CI_DB_sqlite_result extends CI_DB_result {
-
- /**
- * Number of rows in the result set
- *
- * @return int
- */
- public function num_rows()
- {
- return is_int($this->num_rows)
- ? $this->num_rows
- : $this->num_rows = @sqlite_num_rows($this->result_id);
- }
-
- // --------------------------------------------------------------------
-
- /**
- * Number of fields in the result set
- *
- * @return int
- */
- public function num_fields()
- {
- return @sqlite_num_fields($this->result_id);
- }
-
- // --------------------------------------------------------------------
-
- /**
- * Fetch Field Names
- *
- * Generates an array of column names
- *
- * @return array
- */
- public function list_fields()
- {
- $field_names = array();
- for ($i = 0, $c = $this->num_fields(); $i < $c; $i++)
- {
- $field_names[$i] = sqlite_field_name($this->result_id, $i);
- }
-
- return $field_names;
- }
-
- // --------------------------------------------------------------------
-
- /**
- * Field data
- *
- * Generates an array of objects containing field meta-data
- *
- * @return array
- */
- public function field_data()
- {
- $retval = array();
- for ($i = 0, $c = $this->num_fields(); $i < $c; $i++)
- {
- $retval[$i] = new stdClass();
- $retval[$i]->name = sqlite_field_name($this->result_id, $i);
- $retval[$i]->type = NULL;
- $retval[$i]->max_length = NULL;
- }
-
- return $retval;
- }
-
- // --------------------------------------------------------------------
-
- /**
- * Data Seek
- *
- * Moves the internal pointer to the desired offset. We call
- * this internally before fetching results to make sure the
- * result set starts at zero.
- *
- * @param int $n
- * @return bool
- */
- public function data_seek($n = 0)
- {
- return sqlite_seek($this->result_id, $n);
- }
-
- // --------------------------------------------------------------------
-
- /**
- * Result - associative array
- *
- * Returns the result set as an array
- *
- * @return array
- */
- protected function _fetch_assoc()
- {
- return sqlite_fetch_array($this->result_id);
- }
-
- // --------------------------------------------------------------------
-
- /**
- * Result - object
- *
- * Returns the result set as an object
- *
- * @param string $class_name
- * @return object
- */
- protected function _fetch_object($class_name = 'stdClass')
- {
- return sqlite_fetch_object($this->result_id, $class_name);
- }
-
-}
diff --git a/system/database/drivers/sqlite/sqlite_utility.php b/system/database/drivers/sqlite/sqlite_utility.php
deleted file mode 100644
index 99b61227a..000000000
--- a/system/database/drivers/sqlite/sqlite_utility.php
+++ /dev/null
@@ -1,61 +0,0 @@
-<?php
-/**
- * CodeIgniter
- *
- * An open source application development framework for PHP
- *
- * This content is released under the MIT License (MIT)
- *
- * Copyright (c) 2014 - 2019, British Columbia Institute of Technology
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- *
- * @package CodeIgniter
- * @author EllisLab Dev Team
- * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
- * @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (http://bcit.ca/)
- * @license http://opensource.org/licenses/MIT MIT License
- * @link https://codeigniter.com
- * @since Version 1.3.0
- * @filesource
- */
-defined('BASEPATH') OR exit('No direct script access allowed');
-
-/**
- * SQLite Utility Class
- *
- * @category Database
- * @author EllisLab Dev Team
- * @link https://codeigniter.com/userguide3/database/
- */
-class CI_DB_sqlite_utility extends CI_DB_utility {
-
- /**
- * Export
- *
- * @param array $params Preferences
- * @return mixed
- */
- protected function _backup($params = array())
- {
- // Currently unsupported
- return $this->db->display_error('db_unsupported_feature');
- }
-
-}
diff --git a/system/database/drivers/sqlite3/index.html b/system/database/drivers/sqlite3/index.html
index b702fbc39..bcb7cae34 100644
--- a/system/database/drivers/sqlite3/index.html
+++ b/system/database/drivers/sqlite3/index.html
@@ -1,5 +1,5 @@
<!DOCTYPE html>
-<html>
+<html lang="en">
<head>
<title>403 Forbidden</title>
</head>
diff --git a/system/database/drivers/sqlsrv/index.html b/system/database/drivers/sqlsrv/index.html
index b702fbc39..bcb7cae34 100644
--- a/system/database/drivers/sqlsrv/index.html
+++ b/system/database/drivers/sqlsrv/index.html
@@ -1,5 +1,5 @@
<!DOCTYPE html>
-<html>
+<html lang="en">
<head>
<title>403 Forbidden</title>
</head>
diff --git a/system/database/index.html b/system/database/index.html
index b702fbc39..bcb7cae34 100644
--- a/system/database/index.html
+++ b/system/database/index.html
@@ -1,5 +1,5 @@
<!DOCTYPE html>
-<html>
+<html lang="en">
<head>
<title>403 Forbidden</title>
</head>