summaryrefslogtreecommitdiffstats
path: root/system/database
diff options
context:
space:
mode:
Diffstat (limited to 'system/database')
-rwxr-xr-xsystem/database/DB.php10
-rw-r--r--system/database/DB_cache.php20
-rw-r--r--system/database/DB_driver.php50
-rw-r--r--system/database/DB_forge.php22
-rw-r--r--system/database/DB_query_builder.php60
-rw-r--r--system/database/DB_result.php14
-rw-r--r--system/database/DB_utility.php4
-rw-r--r--system/database/drivers/cubrid/cubrid_driver.php10
-rw-r--r--system/database/drivers/cubrid/cubrid_forge.php2
-rw-r--r--system/database/drivers/interbase/interbase_driver.php2
-rw-r--r--system/database/drivers/interbase/interbase_forge.php4
-rw-r--r--system/database/drivers/mssql/mssql_driver.php6
-rw-r--r--system/database/drivers/mssql/mssql_forge.php6
-rw-r--r--system/database/drivers/mysql/mysql_driver.php12
-rw-r--r--system/database/drivers/mysql/mysql_forge.php2
-rw-r--r--system/database/drivers/mysql/mysql_utility.php8
-rw-r--r--system/database/drivers/mysqli/mysqli_driver.php14
-rw-r--r--system/database/drivers/mysqli/mysqli_forge.php2
-rw-r--r--system/database/drivers/oci8/oci8_driver.php6
-rw-r--r--system/database/drivers/oci8/oci8_forge.php4
-rw-r--r--system/database/drivers/odbc/odbc_driver.php4
-rw-r--r--system/database/drivers/odbc/odbc_forge.php6
-rw-r--r--system/database/drivers/pdo/pdo_driver.php22
-rw-r--r--system/database/drivers/pdo/pdo_forge.php8
-rw-r--r--system/database/drivers/postgre/postgre_driver.php14
-rw-r--r--system/database/drivers/postgre/postgre_forge.php2
-rw-r--r--system/database/drivers/sqlite/sqlite_driver.php4
-rw-r--r--system/database/drivers/sqlite/sqlite_forge.php6
-rw-r--r--system/database/drivers/sqlite3/sqlite3_driver.php2
-rw-r--r--system/database/drivers/sqlite3/sqlite3_forge.php2
-rw-r--r--system/database/drivers/sqlsrv/sqlsrv_forge.php6
31 files changed, 167 insertions, 167 deletions
diff --git a/system/database/DB.php b/system/database/DB.php
index 1fe44c0e5..b0113b6f4 100755
--- a/system/database/DB.php
+++ b/system/database/DB.php
@@ -53,7 +53,7 @@ function &DB($params = '', $query_builder_override = NULL)
show_error('No database connection settings were found in the database config file.');
}
- if ($params != '')
+ if ($params !== '')
{
$active_group = $params;
}
@@ -106,7 +106,7 @@ function &DB($params = '', $query_builder_override = NULL)
}
// No DB specified yet? Beat them senseless...
- if ( ! isset($params['dbdriver']) OR $params['dbdriver'] == '')
+ if ( ! isset($params['dbdriver']) OR $params['dbdriver'] === '')
{
show_error('You have not selected a database type to connect to.');
}
@@ -128,7 +128,7 @@ function &DB($params = '', $query_builder_override = NULL)
require_once(BASEPATH.'database/DB_driver.php');
- if ( ! isset($query_builder) OR $query_builder == TRUE)
+ if ( ! isset($query_builder) OR $query_builder === TRUE)
{
require_once(BASEPATH.'database/DB_query_builder.php');
if ( ! class_exists('CI_DB'))
@@ -152,12 +152,12 @@ function &DB($params = '', $query_builder_override = NULL)
$driver = 'CI_DB_'.$params['dbdriver'].'_driver';
$DB = new $driver($params);
- if ($DB->autoinit == TRUE)
+ if ($DB->autoinit === TRUE)
{
$DB->initialize();
}
- if (isset($params['stricton']) && $params['stricton'] == TRUE)
+ if (isset($params['stricton']) && $params['stricton'] === TRUE)
{
$DB->query('SET SESSION sql_mode="STRICT_ALL_TABLES"');
}
diff --git a/system/database/DB_cache.php b/system/database/DB_cache.php
index ff942856b..443bbce5f 100644
--- a/system/database/DB_cache.php
+++ b/system/database/DB_cache.php
@@ -55,9 +55,9 @@ class CI_DB_Cache {
*/
public function check_path($path = '')
{
- if ($path == '')
+ if ($path === '')
{
- if ($this->db->cachedir == '')
+ if ($this->db->cachedir === '')
{
return $this->db->cache_off();
}
@@ -95,8 +95,8 @@ class CI_DB_Cache {
return $this->db->cache_off();
}
- $segment_one = ($this->CI->uri->segment(1) == FALSE) ? 'default' : $this->CI->uri->segment(1);
- $segment_two = ($this->CI->uri->segment(2) == FALSE) ? 'index' : $this->CI->uri->segment(2);
+ $segment_one = ($this->CI->uri->segment(1) === FALSE) ? 'default' : $this->CI->uri->segment(1);
+ $segment_two = ($this->CI->uri->segment(2) === FALSE) ? 'index' : $this->CI->uri->segment(2);
$filepath = $this->db->cachedir.$segment_one.'+'.$segment_two.'/'.md5($sql);
if (FALSE === ($cachedata = read_file($filepath)))
@@ -121,8 +121,8 @@ class CI_DB_Cache {
return $this->db->cache_off();
}
- $segment_one = ($this->CI->uri->segment(1) == FALSE) ? 'default' : $this->CI->uri->segment(1);
- $segment_two = ($this->CI->uri->segment(2) == FALSE) ? 'index' : $this->CI->uri->segment(2);
+ $segment_one = ($this->CI->uri->segment(1) === FALSE) ? 'default' : $this->CI->uri->segment(1);
+ $segment_two = ($this->CI->uri->segment(2) === FALSE) ? 'index' : $this->CI->uri->segment(2);
$dir_path = $this->db->cachedir.$segment_one.'+'.$segment_two.'/';
$filename = md5($sql);
@@ -154,14 +154,14 @@ class CI_DB_Cache {
*/
public function delete($segment_one = '', $segment_two = '')
{
- if ($segment_one == '')
+ if ($segment_one === '')
{
- $segment_one = ($this->CI->uri->segment(1) == FALSE) ? 'default' : $this->CI->uri->segment(1);
+ $segment_one = ($this->CI->uri->segment(1) === FALSE) ? 'default' : $this->CI->uri->segment(1);
}
- if ($segment_two == '')
+ if ($segment_two === '')
{
- $segment_two = ($this->CI->uri->segment(2) == FALSE) ? 'index' : $this->CI->uri->segment(2);
+ $segment_two = ($this->CI->uri->segment(2) === FALSE) ? 'index' : $this->CI->uri->segment(2);
}
$dir_path = $this->db->cachedir.$segment_one.'+'.$segment_two.'/';
diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php
index bbb7b7a80..39c19cdf7 100644
--- a/system/database/DB_driver.php
+++ b/system/database/DB_driver.php
@@ -113,7 +113,7 @@ abstract class CI_DB_driver {
// ----------------------------------------------------------------
// Connect to the database and set the connection ID
- $this->conn_id = ($this->pconnect == FALSE) ? $this->db_connect() : $this->db_pconnect();
+ $this->conn_id = ($this->pconnect === FALSE) ? $this->db_connect() : $this->db_pconnect();
// No connection resource? Check if there is a failover else throw an error
if ( ! $this->conn_id)
@@ -131,7 +131,7 @@ abstract class CI_DB_driver {
}
// Try to connect
- $this->conn_id = ($this->pconnect == FALSE) ? $this->db_connect() : $this->db_pconnect();
+ $this->conn_id = ($this->pconnect === FALSE) ? $this->db_connect() : $this->db_pconnect();
// If a connection is made break the foreach loop
if ($this->conn_id)
@@ -297,7 +297,7 @@ abstract class CI_DB_driver {
*/
public function query($sql, $binds = FALSE, $return_object = TRUE)
{
- if ($sql == '')
+ if ($sql === '')
{
log_message('error', 'Invalid query: '.$sql);
@@ -305,7 +305,7 @@ abstract class CI_DB_driver {
}
// Verify table prefix and replace if necessary
- if ($this->dbprefix != '' && $this->swap_pre != '' && $this->dbprefix != $this->swap_pre)
+ if ($this->dbprefix !== '' && $this->swap_pre !== '' && $this->dbprefix !== $this->swap_pre)
{
$sql = preg_replace('/(\W)'.$this->swap_pre.'(\S+?)/', '\\1'.$this->dbprefix.'\\2', $sql);
}
@@ -319,7 +319,7 @@ abstract class CI_DB_driver {
// Is query caching enabled? If the query is a "read type"
// we will load the caching class and return the previously
// cached query if it exists
- if ($this->cache_on == TRUE && stripos($sql, 'SELECT') !== FALSE && $this->_cache_init())
+ if ($this->cache_on === TRUE && stripos($sql, 'SELECT') !== FALSE && $this->_cache_init())
{
$this->load_rdriver();
if (FALSE !== ($cache = $this->CACHE->read($sql)))
@@ -329,7 +329,7 @@ abstract class CI_DB_driver {
}
// Save the query for debugging
- if ($this->save_queries == TRUE)
+ if ($this->save_queries === TRUE)
{
$this->queries[] = $sql;
}
@@ -340,7 +340,7 @@ abstract class CI_DB_driver {
// Run the Query
if (FALSE === ($this->result_id = $this->simple_query($sql)))
{
- if ($this->save_queries == TRUE)
+ if ($this->save_queries === TRUE)
{
$this->query_times[] = 0;
}
@@ -373,7 +373,7 @@ abstract class CI_DB_driver {
$time_end = microtime(TRUE);
$this->benchmark += $time_end - $time_start;
- if ($this->save_queries == TRUE)
+ if ($this->save_queries === TRUE)
{
$this->query_times[] = $time_end - $time_start;
}
@@ -387,7 +387,7 @@ abstract class CI_DB_driver {
{
// If caching is enabled we'll auto-cleanup any
// existing files related to this particular URI
- if ($this->cache_on == TRUE && $this->cache_autodel == TRUE && $this->_cache_init())
+ if ($this->cache_on === TRUE && $this->cache_autodel === TRUE && $this->_cache_init())
{
$this->CACHE->delete();
}
@@ -409,7 +409,7 @@ abstract class CI_DB_driver {
// Is query caching enabled? If so, we'll serialize the
// result object and save it to a cache file.
- if ($this->cache_on == TRUE && $this->_cache_init())
+ if ($this->cache_on === TRUE && $this->_cache_init())
{
// We'll create a new instance of the result object
// only without the platform specific driver since
@@ -752,13 +752,13 @@ abstract class CI_DB_driver {
*/
public function count_all($table = '')
{
- if ($table == '')
+ if ($table === '')
{
return 0;
}
$query = $this->query($this->_count_string.$this->escape_identifiers('numrows').' FROM '.$this->protect_identifiers($table, TRUE, NULL, FALSE));
- if ($query->num_rows() == 0)
+ if ($query->num_rows() === 0)
{
return 0;
}
@@ -850,7 +850,7 @@ abstract class CI_DB_driver {
return $this->data_cache['field_names'][$table];
}
- if ($table == '')
+ if ($table === '')
{
return ($this->db_debug) ? $this->display_error('db_field_param_missing') : FALSE;
}
@@ -918,7 +918,7 @@ abstract class CI_DB_driver {
*/
public function field_data($table = '')
{
- if ($table == '')
+ if ($table === '')
{
return ($this->db_debug) ? $this->display_error('db_field_param_missing') : FALSE;
}
@@ -939,7 +939,7 @@ abstract class CI_DB_driver {
*/
public function escape_identifiers($item)
{
- if ($this->_escape_char == '')
+ if ($this->_escape_char === '')
{
return $item;
}
@@ -998,7 +998,7 @@ abstract class CI_DB_driver {
*/
public function update_string($table, $data, $where)
{
- if ($where == '')
+ if ($where === '')
{
return FALSE;
}
@@ -1018,7 +1018,7 @@ abstract class CI_DB_driver {
$dest = array();
foreach ($where as $key => $val)
{
- $prefix = (count($dest) == 0) ? '' : ' AND ';
+ $prefix = (count($dest) === 0) ? '' : ' AND ';
$key = $this->protect_identifiers($key);
if ($val !== '')
@@ -1062,7 +1062,7 @@ abstract class CI_DB_driver {
*/
public function call_function($function)
{
- $driver = ($this->dbdriver == 'postgre') ? 'pg_' : $this->dbdriver.'_';
+ $driver = ($this->dbdriver === 'postgre') ? 'pg_' : $this->dbdriver.'_';
if (FALSE === strpos($driver, $function))
{
@@ -1217,7 +1217,7 @@ abstract class CI_DB_driver {
$heading = $LANG->line('db_error_heading');
- if ($native == TRUE)
+ if ($native === TRUE)
{
$message = (array) $error;
}
@@ -1345,7 +1345,7 @@ abstract class CI_DB_driver {
}
// Is there a table prefix defined in the config file? If not, no need to do anything
- if ($this->dbprefix != '')
+ if ($this->dbprefix !== '')
{
// We now add the table prefix based on some logic.
// Do we have 4 segments (hostname.database.table.column)?
@@ -1369,13 +1369,13 @@ abstract class CI_DB_driver {
// This flag is set when the supplied $item does not contain a field name.
// This can happen when this function is being called from a JOIN.
- if ($field_exists == FALSE)
+ if ($field_exists === FALSE)
{
$i++;
}
// Verify table prefix and replace if necessary
- if ($this->swap_pre != '' && strpos($parts[$i], $this->swap_pre) === 0)
+ if ($this->swap_pre !== '' && strpos($parts[$i], $this->swap_pre) === 0)
{
$parts[$i] = preg_replace('/^'.$this->swap_pre.'(\S+?)/', $this->dbprefix.'\\1', $parts[$i]);
}
@@ -1398,15 +1398,15 @@ abstract class CI_DB_driver {
}
// Is there a table prefix? If not, no need to insert it
- if ($this->dbprefix != '')
+ if ($this->dbprefix !== '')
{
// Verify table prefix and replace if necessary
- if ($this->swap_pre != '' && strpos($item, $this->swap_pre) === 0)
+ if ($this->swap_pre !== '' && strpos($item, $this->swap_pre) === 0)
{
$item = preg_replace('/^'.$this->swap_pre.'(\S+?)/', $this->dbprefix.'\\1', $item);
}
// Do we prefix an item with no segments?
- elseif ($prefix_single == TRUE && strpos($item, $this->dbprefix) !== 0)
+ elseif ($prefix_single === TRUE && strpos($item, $this->dbprefix) !== 0)
{
$item = $this->dbprefix.$item;
}
diff --git a/system/database/DB_forge.php b/system/database/DB_forge.php
index a519575f0..ff5eb3fe6 100644
--- a/system/database/DB_forge.php
+++ b/system/database/DB_forge.php
@@ -85,7 +85,7 @@ abstract class CI_DB_forge {
*/
public function drop_database($db_name)
{
- if ($db_name == '')
+ if ($db_name === '')
{
show_error('A table name is required for that operation.');
return FALSE;
@@ -123,7 +123,7 @@ abstract class CI_DB_forge {
return;
}
- if ($key == '')
+ if ($key === '')
{
show_error('Key information is required for that operation.');
}
@@ -150,7 +150,7 @@ abstract class CI_DB_forge {
*/
public function add_field($field = '')
{
- if ($field == '')
+ if ($field === '')
{
show_error('Field information is required.');
}
@@ -197,7 +197,7 @@ abstract class CI_DB_forge {
*/
public function create_table($table = '', $if_not_exists = FALSE)
{
- if ($table == '')
+ if ($table === '')
{
show_error('A table name is required for that operation.');
}
@@ -222,7 +222,7 @@ abstract class CI_DB_forge {
*/
public function drop_table($table_name)
{
- if ($table_name == '')
+ if ($table_name === '')
{
return ($this->db->db_debug) ? $this->db->display_error('db_table_name_required') : FALSE;
}
@@ -245,7 +245,7 @@ abstract class CI_DB_forge {
*/
public function rename_table($table_name, $new_table_name)
{
- if ($table_name == '' OR $new_table_name == '')
+ if ($table_name === '' OR $new_table_name === '')
{
show_error('A table name is required for that operation.');
return FALSE;
@@ -273,7 +273,7 @@ abstract class CI_DB_forge {
*/
public function add_column($table = '', $field = array(), $after_field = '')
{
- if ($table == '')
+ if ($table === '')
{
show_error('A table name is required for that operation.');
}
@@ -284,7 +284,7 @@ abstract class CI_DB_forge {
{
$this->add_field(array($k => $field[$k]));
- if (count($this->fields) == 0)
+ if (count($this->fields) === 0)
{
show_error('Field information is required.');
}
@@ -312,12 +312,12 @@ abstract class CI_DB_forge {
*/
public function drop_column($table = '', $column_name = '')
{
- if ($table == '')
+ if ($table === '')
{
show_error('A table name is required for that operation.');
}
- if ($column_name == '')
+ if ($column_name === '')
{
show_error('A column name is required for that operation.');
}
@@ -337,7 +337,7 @@ abstract class CI_DB_forge {
*/
public function modify_column($table = '', $field = array())
{
- if ($table == '')
+ if ($table === '')
{
show_error('A table name is required for that operation.');
}
diff --git a/system/database/DB_query_builder.php b/system/database/DB_query_builder.php
index cee4354e9..45d68cd39 100644
--- a/system/database/DB_query_builder.php
+++ b/system/database/DB_query_builder.php
@@ -97,7 +97,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
{
$val = trim($val);
- if ($val != '')
+ if ($val !== '')
{
$this->qb_select[] = $val;
$this->qb_no_escape[] = $escape;
@@ -194,7 +194,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
*/
protected function _max_min_avg_sum($select = '', $alias = '', $type = 'MAX')
{
- if ( ! is_string($select) OR $select == '')
+ if ( ! is_string($select) OR $select === '')
{
$this->display_error('db_invalid_query');
}
@@ -206,7 +206,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
show_error('Invalid function type: '.$type);
}
- if ($alias == '')
+ if ($alias === '')
{
$alias = $this->_create_alias_from_table(trim($select));
}
@@ -325,7 +325,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
*/
public function join($table, $cond, $type = '')
{
- if ($type != '')
+ if ($type !== '')
{
$type = strtoupper(trim($type));
@@ -691,7 +691,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
}
// some platforms require an escape sequence definition for LIKE wildcards
- if ($this->_like_escape_str != '')
+ if ($this->_like_escape_str !== '')
{
$like_statement = $like_statement.sprintf($this->_like_escape_str, $this->_like_escape_chr);
}
@@ -829,7 +829,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
{
$val = trim($val);
- if ($val != '')
+ if ($val !== '')
{
$this->qb_groupby[] = $val = $this->protect_identifiers($val);
@@ -908,7 +908,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
$k .= ' = ';
}
- if ($v != '')
+ if ($v !== '')
{
$v = ' '.$this->escape($v);
}
@@ -941,7 +941,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
$orderby = ''; // Random results want or don't need a field name
$direction = $this->_random_keyword;
}
- elseif (trim($direction) != '')
+ elseif (trim($direction) !== '')
{
$direction = (in_array(strtoupper(trim($direction)), array('ASC', 'DESC'), TRUE)) ? ' '.$direction : ' ASC';
}
@@ -963,7 +963,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
$orderby = implode(', ', $temp);
}
- elseif ($direction != $this->_random_keyword)
+ elseif ($direction !== $this->_random_keyword)
{
if ($escape === TRUE)
{
@@ -1064,7 +1064,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
*/
public function get_compiled_select($table = '', $reset = TRUE)
{
- if ($table != '')
+ if ($table !== '')
{
$this->_track_aliases($table);
$this->from($table);
@@ -1095,7 +1095,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
*/
public function get($table = '', $limit = null, $offset = null)
{
- if ($table != '')
+ if ($table !== '')
{
$this->_track_aliases($table);
$this->from($table);
@@ -1124,7 +1124,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
*/
public function count_all_results($table = '')
{
- if ($table != '')
+ if ($table !== '')
{
$this->_track_aliases($table);
$this->from($table);
@@ -1156,7 +1156,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
*/
public function get_where($table = '', $where = null, $limit = null, $offset = null)
{
- if ($table != '')
+ if ($table !== '')
{
$this->from($table);
}
@@ -1204,7 +1204,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
return FALSE;
}
- if ($table == '')
+ if ($table === '')
{
if ( ! isset($this->qb_from[0]))
{
@@ -1404,7 +1404,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
return ($this->db_debug) ? $this->display_error('db_must_use_set') : FALSE;
}
- if ($table != '')
+ if ($table !== '')
{
$this->qb_from[0] = $table;
}
@@ -1439,7 +1439,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
return ($this->db_debug) ? $this->display_error('db_must_use_set') : FALSE;
}
- if ($table == '')
+ if ($table === '')
{
if ( ! isset($this->qb_from[0]))
{
@@ -1530,12 +1530,12 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
return FALSE;
}
- if ($where != NULL)
+ if ($where !== NULL)
{
$this->where($where);
}
- if ($limit != NULL)
+ if ($limit !== NULL)
{
$this->limit($limit);
}
@@ -1595,12 +1595,12 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
*/
protected function _validate_update($table = '')
{
- if (count($this->qb_set) == 0)
+ if (count($this->qb_set) === 0)
{
return ($this->db_debug) ? $this->display_error('db_must_use_set') : FALSE;
}
- if ($table != '')
+ if ($table !== '')
{
$this->qb_from[0] = $table;
}
@@ -1644,7 +1644,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
return ($this->db_debug) ? $this->display_error('db_must_use_set') : FALSE;
}
- if ($table == '')
+ if ($table === '')
{
if ( ! isset($this->qb_from[0]))
{
@@ -1689,7 +1689,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
$clean = array();
foreach ($v as $k2 => $v2)
{
- if ($k2 == $index)
+ if ($k2 === $index)
{
$index_set = TRUE;
}
@@ -1720,7 +1720,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
*/
public function empty_table($table = '')
{
- if ($table == '')
+ if ($table === '')
{
if ( ! isset($this->qb_from[0]))
{
@@ -1753,7 +1753,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
*/
public function truncate($table = '')
{
- if ($table == '')
+ if ($table === '')
{
if ( ! isset($this->qb_from[0]))
{
@@ -1827,7 +1827,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
// Combine any cached components with the current statements
$this->_merge_cache();
- if ($table == '')
+ if ($table === '')
{
if ( ! isset($this->qb_from[0]))
{
@@ -1851,12 +1851,12 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
$table = $this->protect_identifiers($table, TRUE, NULL, FALSE);
}
- if ($where != '')
+ if ($where !== '')
{
$this->where($where);
}
- if ($limit != NULL)
+ if ($limit !== NULL)
{
$this->limit($limit);
}
@@ -1912,7 +1912,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
*/
public function dbprefix($table = '')
{
- if ($table == '')
+ if ($table === '')
{
$this->display_error('db_table_name_required');
}
@@ -2072,7 +2072,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
$sql .= "\nORDER BY ".implode(', ', $this->qb_orderby);
if ($this->qb_order !== FALSE)
{
- $sql .= ($this->qb_order == 'desc') ? ' DESC' : ' ASC';
+ $sql .= ($this->qb_order === 'desc') ? ' DESC' : ' ASC';
}
}
@@ -2106,7 +2106,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
foreach (get_object_vars($object) as $key => $val)
{
// There are some built in keys we need to ignore for this conversion
- if ( ! is_object($val) && ! is_array($val) && $key != '_parent_name')
+ if ( ! is_object($val) && ! is_array($val) && $key !== '_parent_name')
{
$array[$key] = $val;
}
diff --git a/system/database/DB_result.php b/system/database/DB_result.php
index 334e08c72..991f6ba94 100644
--- a/system/database/DB_result.php
+++ b/system/database/DB_result.php
@@ -81,7 +81,7 @@ class CI_DB_result {
return $this->custom_result_object[$class_name];
}
- if ($this->result_id === FALSE OR $this->num_rows() == 0)
+ if ($this->result_id === FALSE OR $this->num_rows() === 0)
{
return array();
}
@@ -122,7 +122,7 @@ class CI_DB_result {
// In the event that query caching is on the result_id variable
// will return FALSE since there isn't a valid SQL resource so
// we'll simply return an empty array.
- if ($this->result_id === FALSE OR $this->num_rows() == 0)
+ if ($this->result_id === FALSE OR $this->num_rows() === 0)
{
return array();
}
@@ -153,7 +153,7 @@ class CI_DB_result {
// In the event that query caching is on the result_id variable
// will return FALSE since there isn't a valid SQL resource so
// we'll simply return an empty array.
- if ($this->result_id === FALSE OR $this->num_rows() == 0)
+ if ($this->result_id === FALSE OR $this->num_rows() === 0)
{
return array();
}
@@ -224,7 +224,7 @@ class CI_DB_result {
return;
}
- if ($key != '' && ! is_null($value))
+ if ($key !== '' && ! is_null($value))
{
$this->row_data[$key] = $value;
}
@@ -245,7 +245,7 @@ class CI_DB_result {
return NULL;
}
- if ($n != $this->current_row && isset($result[$n]))
+ if ($n !== $this->current_row && isset($result[$n]))
{
$this->current_row = $n;
}
@@ -268,7 +268,7 @@ class CI_DB_result {
return NULL;
}
- if ($n != $this->current_row && isset($result[$n]))
+ if ($n !== $this->current_row && isset($result[$n]))
{
$this->current_row = $n;
}
@@ -291,7 +291,7 @@ class CI_DB_result {
return NULL;
}
- if ($n != $this->current_row && isset($result[$n]))
+ if ($n !== $this->current_row && isset($result[$n]))
{
$this->current_row = $n;
}
diff --git a/system/database/DB_utility.php b/system/database/DB_utility.php
index cb97ff448..02c921834 100644
--- a/system/database/DB_utility.php
+++ b/system/database/DB_utility.php
@@ -343,7 +343,7 @@ abstract class CI_DB_utility extends CI_DB_forge {
if ($prefs['format'] === 'zip')
{
// Set the filename if not provided (only needed with Zip files)
- if ($prefs['filename'] == '')
+ if ($prefs['filename'] === '')
{
$prefs['filename'] = (count($prefs['tables']) === 1 ? $prefs['tables'] : $this->db->database)
.date('Y-m-d_H-i', time()).'.sql';
@@ -369,7 +369,7 @@ abstract class CI_DB_utility extends CI_DB_forge {
$CI->zip->add_data($prefs['filename'], $this->_backup($prefs));
return $CI->zip->get_zip();
}
- elseif ($prefs['format'] == 'txt') // Was a text file requested?
+ elseif ($prefs['format'] === 'txt') // Was a text file requested?
{
return $this->_backup($prefs);
}
diff --git a/system/database/drivers/cubrid/cubrid_driver.php b/system/database/drivers/cubrid/cubrid_driver.php
index 817dfdc98..b7763d90f 100644
--- a/system/database/drivers/cubrid/cubrid_driver.php
+++ b/system/database/drivers/cubrid/cubrid_driver.php
@@ -74,7 +74,7 @@ class CI_DB_cubrid_driver extends CI_DB {
else
{
// If no port is defined by the user, use the default value
- $this->port == '' OR $this->port = 33000;
+ $this->port === '' OR $this->port = 33000;
}
}
@@ -340,7 +340,7 @@ class CI_DB_cubrid_driver extends CI_DB {
{
$sql = 'SHOW TABLES';
- if ($prefix_limit !== FALSE && $this->dbprefix != '')
+ if ($prefix_limit !== FALSE && $this->dbprefix !== '')
{
return $sql." LIKE '".$this->escape_like_str($this->dbprefix)."%'";
}
@@ -435,7 +435,7 @@ class CI_DB_cubrid_driver extends CI_DB {
foreach (array_keys($val) as $field)
{
- if ($field != $index)
+ if ($field !== $index)
{
$final[$field][] = 'WHEN '.$index.' = '.$val[$index].' THEN '.$val[$field];
}
@@ -451,7 +451,7 @@ class CI_DB_cubrid_driver extends CI_DB {
}
return 'UPDATE '.$table.' SET '.substr($cases, 0, -2)
- .' WHERE '.(($where != '' && count($where) > 0) ? implode(' ', $where).' AND ' : '')
+ .' WHERE '.(($where !== '' && count($where) > 0) ? implode(' ', $where).' AND ' : '')
.$index.' IN ('.implode(',', $ids).')';
}
@@ -469,7 +469,7 @@ class CI_DB_cubrid_driver extends CI_DB {
*/
protected function _limit($sql, $limit, $offset)
{
- return $sql.'LIMIT '.($offset == 0 ? '' : $offset.', ').$limit;
+ return $sql.'LIMIT '.($offset === 0 ? '' : $offset.', ').$limit;
}
// --------------------------------------------------------------------
diff --git a/system/database/drivers/cubrid/cubrid_forge.php b/system/database/drivers/cubrid/cubrid_forge.php
index 4e66f81e3..fb9716226 100644
--- a/system/database/drivers/cubrid/cubrid_forge.php
+++ b/system/database/drivers/cubrid/cubrid_forge.php
@@ -193,7 +193,7 @@ class CI_DB_cubrid_forge extends CI_DB_forge {
}
return $sql.$this->_process_fields($fields)
- .($after_field != '' ? ' AFTER '.$this->db->protect_identifiers($after_field) : '');
+ .($after_field !== '' ? ' AFTER '.$this->db->protect_identifiers($after_field) : '');
}
}
diff --git a/system/database/drivers/interbase/interbase_driver.php b/system/database/drivers/interbase/interbase_driver.php
index 49d3cda87..8cbbfa17d 100644
--- a/system/database/drivers/interbase/interbase_driver.php
+++ b/system/database/drivers/interbase/interbase_driver.php
@@ -255,7 +255,7 @@ class CI_DB_interbase_driver extends CI_DB {
{
$sql = 'SELECT "RDB$RELATION_NAME" FROM "RDB$RELATIONS" WHERE "RDB$RELATION_NAME" NOT LIKE \'RDB$%\' AND "RDB$RELATION_NAME" NOT LIKE \'MON$%\'';
- if ($prefix_limit !== FALSE && $this->dbprefix != '')
+ if ($prefix_limit !== FALSE && $this->dbprefix !== '')
{
return $sql.' AND "RDB$RELATION_NAME" LIKE \''.$this->escape_like_str($this->dbprefix)."%' ".sprintf($this->_like_escape_str, $this->_like_escape_chr);
}
diff --git a/system/database/drivers/interbase/interbase_forge.php b/system/database/drivers/interbase/interbase_forge.php
index c850656a8..5470179a1 100644
--- a/system/database/drivers/interbase/interbase_forge.php
+++ b/system/database/drivers/interbase/interbase_forge.php
@@ -195,7 +195,7 @@ class CI_DB_interbase_forge extends CI_DB_forge {
$sql .= " {$column_definition}";
- if ($default_value != '')
+ if ($default_value !== '')
{
$sql .= " DEFAULT \"{$default_value}\"";
}
@@ -209,7 +209,7 @@ class CI_DB_interbase_forge extends CI_DB_forge {
$sql .= ' NOT NULL';
}
- if ($after_field != '')
+ if ($after_field !== '')
{
$sql .= ' AFTER ' . $this->db->protect_identifiers($after_field);
}
diff --git a/system/database/drivers/mssql/mssql_driver.php b/system/database/drivers/mssql/mssql_driver.php
index 342ff2647..5bd666960 100644
--- a/system/database/drivers/mssql/mssql_driver.php
+++ b/system/database/drivers/mssql/mssql_driver.php
@@ -64,7 +64,7 @@ class CI_DB_mssql_driver extends CI_DB {
*/
public function db_connect()
{
- if ($this->port != '')
+ if ($this->port !== '')
{
$this->hostname .= ','.$this->port;
}
@@ -81,7 +81,7 @@ class CI_DB_mssql_driver extends CI_DB {
*/
public function db_pconnect()
{
- if ($this->port != '')
+ if ($this->port !== '')
{
$this->hostname .= ','.$this->port;
}
@@ -316,7 +316,7 @@ class CI_DB_mssql_driver extends CI_DB {
$sql = "SELECT name FROM sysobjects WHERE type = 'U' ORDER BY name";
// for future compatibility
- if ($prefix_limit !== FALSE AND $this->dbprefix != '')
+ if ($prefix_limit !== FALSE AND $this->dbprefix !== '')
{
//$sql .= " LIKE '".$this->escape_like_str($this->dbprefix)."%' ".sprintf($this->_like_escape_str, $this->_like_escape_chr);
return FALSE; // not currently supported
diff --git a/system/database/drivers/mssql/mssql_forge.php b/system/database/drivers/mssql/mssql_forge.php
index bbf2d9685..3708c2233 100644
--- a/system/database/drivers/mssql/mssql_forge.php
+++ b/system/database/drivers/mssql/mssql_forge.php
@@ -155,21 +155,21 @@ class CI_DB_mssql_forge extends CI_DB_forge {
$sql = 'ALTER TABLE '.$this->db->protect_identifiers($table).' '.$alter_type.' '.$this->db->protect_identifiers($column_name);
// DROP has everything it needs now.
- if ($alter_type == 'DROP')
+ if ($alter_type === 'DROP')
{
return $sql;
}
$sql .= " ".$column_definition;
- if ($default_value != '')
+ if ($default_value !== '')
{
$sql .= " DEFAULT '".$default_value."'";
}
$sql .= ($null === NULL) ? ' NULL' : ' NOT NULL';
- if ($after_field != '')
+ if ($after_field !== '')
{
return $sql.' AFTER '.$this->db->protect_identifiers($after_field);
}
diff --git a/system/database/drivers/mysql/mysql_driver.php b/system/database/drivers/mysql/mysql_driver.php
index 7a1a7b9a2..41e86f315 100644
--- a/system/database/drivers/mysql/mysql_driver.php
+++ b/system/database/drivers/mysql/mysql_driver.php
@@ -68,7 +68,7 @@ class CI_DB_mysql_driver extends CI_DB {
{
parent::__construct($params);
- if ($this->port != '')
+ if ($this->port !== '')
{
$this->hostname .= ':'.$this->port;
}
@@ -337,7 +337,7 @@ class CI_DB_mysql_driver extends CI_DB {
{
$sql = 'SHOW TABLES FROM '.$this->_escape_char.$this->database.$this->_escape_char;
- if ($prefix_limit !== FALSE && $this->dbprefix != '')
+ if ($prefix_limit !== FALSE && $this->dbprefix !== '')
{
return $sql." LIKE '".$this->escape_like_str($this->dbprefix)."%'";
}
@@ -370,7 +370,7 @@ class CI_DB_mysql_driver extends CI_DB {
*/
public function field_data($table = '')
{
- if ($table == '')
+ if ($table === '')
{
return ($this->db_debug) ? $this->display_error('db_field_param_missing') : FALSE;
}
@@ -451,7 +451,7 @@ class CI_DB_mysql_driver extends CI_DB {
foreach (array_keys($val) as $field)
{
- if ($field != $index)
+ if ($field !== $index)
{
$final[$field][] = 'WHEN '.$index.' = '.$val[$index].' THEN '.$val[$field];
}
@@ -467,7 +467,7 @@ class CI_DB_mysql_driver extends CI_DB {
}
return 'UPDATE '.$table.' SET '.substr($cases, 0, -2)
- .' WHERE '.(($where != '' && count($where) > 0) ? implode(' ', $where).' AND ' : '')
+ .' WHERE '.(($where !== '' && count($where) > 0) ? implode(' ', $where).' AND ' : '')
.$index.' IN('.implode(',', $ids).')';
}
@@ -485,7 +485,7 @@ class CI_DB_mysql_driver extends CI_DB {
*/
protected function _limit($sql, $limit, $offset)
{
- return $sql.' LIMIT '.($offset == 0 ? '' : $offset.', ').$limit;
+ return $sql.' LIMIT '.($offset === 0 ? '' : $offset.', ').$limit;
}
// --------------------------------------------------------------------
diff --git a/system/database/drivers/mysql/mysql_forge.php b/system/database/drivers/mysql/mysql_forge.php
index 0e39affa7..ffd374fbf 100644
--- a/system/database/drivers/mysql/mysql_forge.php
+++ b/system/database/drivers/mysql/mysql_forge.php
@@ -178,7 +178,7 @@ class CI_DB_mysql_forge extends CI_DB_forge {
}
return $sql.$this->_process_fields($fields)
- .($after_field != '' ? ' AFTER '.$this->db->protect_identifiers($after_field) : '');
+ .($after_field !== '' ? ' AFTER '.$this->db->protect_identifiers($after_field) : '');
}
}
diff --git a/system/database/drivers/mysql/mysql_utility.php b/system/database/drivers/mysql/mysql_utility.php
index 642323dbd..643682fde 100644
--- a/system/database/drivers/mysql/mysql_utility.php
+++ b/system/database/drivers/mysql/mysql_utility.php
@@ -76,7 +76,7 @@ class CI_DB_mysql_utility extends CI_DB_utility {
// Write out the table schema
$output .= '#'.$newline.'# TABLE STRUCTURE FOR: '.$table.$newline.'#'.$newline.$newline;
- if ($add_drop == TRUE)
+ if ($add_drop === TRUE)
{
$output .= 'DROP TABLE IF EXISTS '.$this->db->protect_identifiers($table).';'.$newline.$newline;
}
@@ -92,7 +92,7 @@ class CI_DB_mysql_utility extends CI_DB_utility {
}
// If inserts are not needed we're done...
- if ($add_insert == FALSE)
+ if ($add_insert === FALSE)
{
continue;
}
@@ -100,7 +100,7 @@ class CI_DB_mysql_utility extends CI_DB_utility {
// Grab all the data from the current table
$query = $this->db->query('SELECT * FROM '.$this->db->protect_identifiers($table));
- if ($query->num_rows() == 0)
+ if ($query->num_rows() === 0)
{
continue;
}
@@ -143,7 +143,7 @@ class CI_DB_mysql_utility extends CI_DB_utility {
else
{
// Escape the data if it's not an integer
- $val_str .= ($is_int[$i] == FALSE) ? $this->db->escape($v) : $v;
+ $val_str .= ($is_int[$i] === FALSE) ? $this->db->escape($v) : $v;
}
// Append a comma
diff --git a/system/database/drivers/mysqli/mysqli_driver.php b/system/database/drivers/mysqli/mysqli_driver.php
index dd544f686..5814aceb9 100644
--- a/system/database/drivers/mysqli/mysqli_driver.php
+++ b/system/database/drivers/mysqli/mysqli_driver.php
@@ -71,7 +71,7 @@ class CI_DB_mysqli_driver extends CI_DB {
*/
public function db_connect()
{
- return ($this->port != '')
+ return ($this->port !== '')
? @new mysqli($this->hostname, $this->username, $this->password, $this->database, $this->port)
: @new mysqli($this->hostname, $this->username, $this->password, $this->database);
}
@@ -91,7 +91,7 @@ class CI_DB_mysqli_driver extends CI_DB {
return $this->db_connect();
}
- return ($this->port != '')
+ return ($this->port !== '')
? @new mysqli('p:'.$this->hostname, $this->username, $this->password, $this->database, $this->port)
: @new mysqli('p:'.$this->hostname, $this->username, $this->password, $this->database);
}
@@ -337,7 +337,7 @@ class CI_DB_mysqli_driver extends CI_DB {
{
$sql = 'SHOW TABLES FROM '.$this->_escape_char.$this->database.$this->_escape_char;
- if ($prefix_limit !== FALSE && $this->dbprefix != '')
+ if ($prefix_limit !== FALSE && $this->dbprefix !== '')
{
return $sql." LIKE '".$this->escape_like_str($this->dbprefix)."%'";
}
@@ -370,7 +370,7 @@ class CI_DB_mysqli_driver extends CI_DB {
*/
public function field_data($table = '')
{
- if ($table == '')
+ if ($table === '')
{
return ($this->db_debug) ? $this->display_error('db_field_param_missing') : FALSE;
}
@@ -451,7 +451,7 @@ class CI_DB_mysqli_driver extends CI_DB {
foreach (array_keys($val) as $field)
{
- if ($field != $index)
+ if ($field !== $index)
{
$final[$field][] = 'WHEN '.$index.' = '.$val[$index].' THEN '.$val[$field];
}
@@ -466,10 +466,10 @@ class CI_DB_mysqli_driver extends CI_DB {
.'ELSE '.$k.' END, ';
}
- $where = ($where != '' && count($where) > 0) ? implode(' ', $where).' AND ' : '';
+ $where = ($where !== '' && count($where) > 0) ? implode(' ', $where).' AND ' : '';
return 'UPDATE '.$table.' SET '.substr($cases, 0, -2)
- .' WHERE '.(($where != '' && count($where) > 0) ? implode(' ', $where).' AND ' : '')
+ .' WHERE '.(($where !== '' && count($where) > 0) ? implode(' ', $where).' AND ' : '')
.$index.' IN('.implode(',', $ids).')';
}
diff --git a/system/database/drivers/mysqli/mysqli_forge.php b/system/database/drivers/mysqli/mysqli_forge.php
index 503574dfc..b00bfde49 100644
--- a/system/database/drivers/mysqli/mysqli_forge.php
+++ b/system/database/drivers/mysqli/mysqli_forge.php
@@ -179,7 +179,7 @@ class CI_DB_mysqli_forge extends CI_DB_forge {
}
return $sql.$this->_process_fields($fields)
- .($after_field != '' ? ' AFTER '.$this->db->protect_identifiers($after_field) : '');
+ .($after_field !== '' ? ' AFTER '.$this->db->protect_identifiers($after_field) : '');
}
}
diff --git a/system/database/drivers/oci8/oci8_driver.php b/system/database/drivers/oci8/oci8_driver.php
index b979c8a17..e78091614 100644
--- a/system/database/drivers/oci8/oci8_driver.php
+++ b/system/database/drivers/oci8/oci8_driver.php
@@ -262,7 +262,7 @@ class CI_DB_oci8_driver extends CI_DB {
*/
public function stored_procedure($package, $procedure, $params)
{
- if ($package == '' OR $procedure == '' OR ! is_array($params))
+ if ($package === '' OR $procedure === '' OR ! is_array($params))
{
if ($this->db_debug)
{
@@ -466,7 +466,7 @@ class CI_DB_oci8_driver extends CI_DB {
{
$sql = 'SELECT TABLE_NAME FROM ALL_TABLES';
- if ($prefix_limit !== FALSE && $this->dbprefix != '')
+ if ($prefix_limit !== FALSE && $this->dbprefix !== '')
{
return $sql." WHERE TABLE_NAME LIKE '".$this->escape_like_str($this->dbprefix)."%' ".sprintf($this->_like_escape_str, $this->_like_escape_chr);
}
@@ -634,7 +634,7 @@ class CI_DB_oci8_driver extends CI_DB {
{
$this->limit_used = TRUE;
return 'SELECT * FROM (SELECT inner_query.*, rownum rnum FROM ('.$sql.') inner_query WHERE rownum < '.($offset + $limit).')'
- .($offset != 0 ? ' WHERE rnum >= '.$offset : '');
+ .($offset !== 0 ? ' WHERE rnum >= '.$offset : '');
}
// --------------------------------------------------------------------
diff --git a/system/database/drivers/oci8/oci8_forge.php b/system/database/drivers/oci8/oci8_forge.php
index bd265b6e0..837e7eaad 100644
--- a/system/database/drivers/oci8/oci8_forge.php
+++ b/system/database/drivers/oci8/oci8_forge.php
@@ -141,9 +141,9 @@ class CI_DB_oci8_forge extends CI_DB_forge {
}
return $sql.' '.$column_definition
- .($default_value != '' ? ' DEFAULT "'.$default_value.'"' : '')
+ .($default_value !== '' ? ' DEFAULT "'.$default_value.'"' : '')
.($null === NULL ? ' NULL' : ' NOT NULL')
- .($after_field != '' ? ' AFTER '.$this->db->protect_identifiers($after_field) : '');
+ .($after_field !== '' ? ' AFTER '.$this->db->protect_identifiers($after_field) : '');
}
diff --git a/system/database/drivers/odbc/odbc_driver.php b/system/database/drivers/odbc/odbc_driver.php
index 98fd806a8..b493e9335 100644
--- a/system/database/drivers/odbc/odbc_driver.php
+++ b/system/database/drivers/odbc/odbc_driver.php
@@ -64,7 +64,7 @@ class CI_DB_odbc_driver extends CI_DB {
$this->_random_keyword = ' RND('.time().')'; // database specific random keyword
// Legacy support for DSN in the hostname field
- if ($this->dsn == '')
+ if ($this->dsn === '')
{
$this->dsn = $this->hostname;
}
@@ -256,7 +256,7 @@ class CI_DB_odbc_driver extends CI_DB {
{
$sql = "SHOW TABLES FROM `".$this->database."`";
- if ($prefix_limit !== FALSE AND $this->dbprefix != '')
+ if ($prefix_limit !== FALSE AND $this->dbprefix !== '')
{
//$sql .= " LIKE '".$this->escape_like_str($this->dbprefix)."%' ".sprintf($this->_like_escape_str, $this->_like_escape_chr);
return FALSE; // not currently supported
diff --git a/system/database/drivers/odbc/odbc_forge.php b/system/database/drivers/odbc/odbc_forge.php
index d59b8a911..ce7a1d2ef 100644
--- a/system/database/drivers/odbc/odbc_forge.php
+++ b/system/database/drivers/odbc/odbc_forge.php
@@ -163,14 +163,14 @@ class CI_DB_odbc_forge extends CI_DB_forge {
$sql = 'ALTER TABLE '.$this->db->protect_identifiers($table).' '.$alter_type.' '.$this->db->protect_identifiers($column_name);
// DROP has everything it needs now.
- if ($alter_type == 'DROP')
+ if ($alter_type === 'DROP')
{
return $sql;
}
$sql .= " $column_definition";
- if ($default_value != '')
+ if ($default_value !== '')
{
$sql .= " DEFAULT \"$default_value\"";
}
@@ -184,7 +184,7 @@ class CI_DB_odbc_forge extends CI_DB_forge {
$sql .= ' NOT NULL';
}
- if ($after_field != '')
+ if ($after_field !== '')
{
return $sql.' AFTER '.$this->db->protect_identifiers($after_field);
}
diff --git a/system/database/drivers/pdo/pdo_driver.php b/system/database/drivers/pdo/pdo_driver.php
index ec7f3e19b..dbbcda342 100644
--- a/system/database/drivers/pdo/pdo_driver.php
+++ b/system/database/drivers/pdo/pdo_driver.php
@@ -65,7 +65,7 @@ class CI_DB_pdo_driver extends CI_DB {
{
parent::__construct($params);
- if (preg_match('/([^;]+):/', $this->dsn, $match) && count($match) == 2)
+ if (preg_match('/([^;]+):/', $this->dsn, $match) && count($match) === 2)
{
// If there is a minimum valid dsn string pattern found, we're done
// This is for general PDO users, who tend to have a full DSN string.
@@ -418,12 +418,12 @@ class CI_DB_pdo_driver extends CI_DB {
*/
protected function _list_tables($prefix_limit = FALSE)
{
- if ($this->pdodriver == 'pgsql')
+ if ($this->pdodriver === 'pgsql')
{
// Analog function to show all tables in postgre
$sql = "SELECT * FROM information_schema.tables WHERE table_schema = 'public'";
}
- elseif ($this->pdodriver == 'sqlite')
+ elseif ($this->pdodriver === 'sqlite')
{
// Analog function to show all tables in sqlite
$sql = "SELECT name FROM sqlite_master WHERE type='table' AND name NOT LIKE 'sqlite_%'";
@@ -433,7 +433,7 @@ class CI_DB_pdo_driver extends CI_DB {
$sql = 'SHOW TABLES FROM '.$this->escape_identifiers($this->database);
}
- if ($prefix_limit !== FALSE AND $this->dbprefix != '')
+ if ($prefix_limit !== FALSE AND $this->dbprefix !== '')
{
return FALSE;
}
@@ -468,17 +468,17 @@ class CI_DB_pdo_driver extends CI_DB {
*/
protected function _field_data($table)
{
- if ($this->pdodriver == 'mysql' or $this->pdodriver == 'pgsql')
+ if ($this->pdodriver === 'mysql' or $this->pdodriver === 'pgsql')
{
// Analog function for mysql and postgre
return 'SELECT * FROM '.$this->escape_identifiers($table).' LIMIT 1';
}
- elseif ($this->pdodriver == 'oci')
+ elseif ($this->pdodriver === 'oci')
{
// Analog function for oci
return 'SELECT * FROM '.$this->escape_identifiers($table).' WHERE ROWNUM <= 1';
}
- elseif ($this->pdodriver == 'sqlite')
+ elseif ($this->pdodriver === 'sqlite')
{
// Analog function for sqlite
return 'PRAGMA table_info('.$this->escape_identifiers($table).')';
@@ -552,7 +552,7 @@ class CI_DB_pdo_driver extends CI_DB {
protected function _update_batch($table, $values, $index, $where = NULL)
{
$ids = array();
- $where = ($where != '' && count($where) >=1) ? implode(" ", $where).' AND ' : '';
+ $where = ($where !== '' && count($where) >=1) ? implode(" ", $where).' AND ' : '';
foreach ($values as $key => $val)
{
@@ -560,7 +560,7 @@ class CI_DB_pdo_driver extends CI_DB {
foreach (array_keys($val) as $field)
{
- if ($field != $index)
+ if ($field !== $index)
{
$final[$field][] = 'WHEN '.$index.' = '.$val[$index].' THEN '.$val[$field];
}
@@ -620,9 +620,9 @@ class CI_DB_pdo_driver extends CI_DB {
*/
protected function _limit($sql, $limit, $offset)
{
- if ($this->pdodriver == 'cubrid' OR $this->pdodriver == 'sqlite')
+ if ($this->pdodriver === 'cubrid' OR $this->pdodriver === 'sqlite')
{
- $offset = ($offset == 0) ? '' : $offset.', ';
+ $offset = ($offset === 0) ? '' : $offset.', ';
return $sql.'LIMIT '.$offset.$limit;
}
diff --git a/system/database/drivers/pdo/pdo_forge.php b/system/database/drivers/pdo/pdo_forge.php
index ca8657a0f..aee8f718a 100644
--- a/system/database/drivers/pdo/pdo_forge.php
+++ b/system/database/drivers/pdo/pdo_forge.php
@@ -80,7 +80,7 @@ class CI_DB_pdo_forge extends CI_DB_forge {
if (array_key_exists('CONSTRAINT', $attributes))
{
// Exception for Postgre numeric which not too happy with constraint within those type
- if ( ! ($this->db->pdodriver == 'pgsql' && in_array($attributes['TYPE'], $numeric)))
+ if ( ! ($this->db->pdodriver === 'pgsql' && in_array($attributes['TYPE'], $numeric)))
{
$sql .= '('.$attributes['CONSTRAINT'].')';
}
@@ -168,14 +168,14 @@ class CI_DB_pdo_forge extends CI_DB_forge {
$sql = 'ALTER TABLE `'.$this->db->protect_identifiers($table).'` '.$alter_type.' '.$this->db->protect_identifiers($column_name);
// DROP has everything it needs now.
- if ($alter_type == 'DROP')
+ if ($alter_type === 'DROP')
{
return $sql;
}
$sql .= " $column_definition";
- if ($default_value != '')
+ if ($default_value !== '')
{
$sql .= " DEFAULT \"$default_value\"";
}
@@ -189,7 +189,7 @@ class CI_DB_pdo_forge extends CI_DB_forge {
$sql .= ' NOT NULL';
}
- if ($after_field != '')
+ if ($after_field !== '')
{
return $sql.' AFTER '.$this->db->protect_identifiers($after_field);
}
diff --git a/system/database/drivers/postgre/postgre_driver.php b/system/database/drivers/postgre/postgre_driver.php
index c2a188416..8c5168400 100644
--- a/system/database/drivers/postgre/postgre_driver.php
+++ b/system/database/drivers/postgre/postgre_driver.php
@@ -356,13 +356,13 @@ class CI_DB_postgre_driver extends CI_DB {
$table = (func_num_args() > 0) ? func_get_arg(0) : NULL;
$column = (func_num_args() > 1) ? func_get_arg(1) : NULL;
- if ($table == NULL && $v >= '8.1')
+ if ($table === NULL && $v >= '8.1')
{
$sql = 'SELECT LASTVAL() AS ins_id';
}
- elseif ($table != NULL)
+ elseif ($table !== NULL)
{
- if ($column != NULL && $v >= '8.0')
+ if ($column !== NULL && $v >= '8.0')
{
$sql = 'SELECT pg_get_serial_sequence(\''.$table."', '".$column."') AS seq";
$query = $this->query($sql);
@@ -401,7 +401,7 @@ class CI_DB_postgre_driver extends CI_DB {
{
$sql = "SELECT table_name FROM information_schema.tables WHERE table_schema = 'public'";
- if ($prefix_limit !== FALSE && $this->dbprefix != '')
+ if ($prefix_limit !== FALSE && $this->dbprefix !== '')
{
return $sql." AND table_name LIKE '".$this->escape_like_str($this->dbprefix)."%' ".sprintf($this->_like_escape_str, $this->_like_escape_chr);
}
@@ -528,7 +528,7 @@ class CI_DB_postgre_driver extends CI_DB {
foreach (array_keys($val) as $field)
{
- if ($field != $index)
+ if ($field !== $index)
{
$final[$field][] = 'WHEN '.$val[$index].' THEN '.$val[$field];
}
@@ -544,7 +544,7 @@ class CI_DB_postgre_driver extends CI_DB {
}
return 'UPDATE '.$table.' SET '.substr($cases, 0, -2)
- .' WHERE '.(($where != '' && count($where) > 0) ? implode(' ', $where).' AND ' : '')
+ .' WHERE '.(($where !== '' && count($where) > 0) ? implode(' ', $where).' AND ' : '')
.$index.' IN('.implode(',', $ids).')';
}
@@ -585,7 +585,7 @@ class CI_DB_postgre_driver extends CI_DB {
*/
protected function _limit($sql, $limit, $offset)
{
- return $sql.' LIMIT '.$limit.($offset == 0 ? '' : ' OFFSET '.$offset);
+ return $sql.' LIMIT '.$limit.($offset === 0 ? '' : ' OFFSET '.$offset);
}
// --------------------------------------------------------------------
diff --git a/system/database/drivers/postgre/postgre_forge.php b/system/database/drivers/postgre/postgre_forge.php
index 94c97af50..af1c45f9b 100644
--- a/system/database/drivers/postgre/postgre_forge.php
+++ b/system/database/drivers/postgre/postgre_forge.php
@@ -214,7 +214,7 @@ class CI_DB_postgre_forge extends CI_DB_forge {
}
return $sql.$this->_process_fields($fields)
- .($after_field != '' ? ' AFTER '.$this->db->protect_identifiers($after_field) : '');
+ .($after_field !== '' ? ' AFTER '.$this->db->protect_identifiers($after_field) : '');
}
}
diff --git a/system/database/drivers/sqlite/sqlite_driver.php b/system/database/drivers/sqlite/sqlite_driver.php
index d8b869c2e..e50239027 100644
--- a/system/database/drivers/sqlite/sqlite_driver.php
+++ b/system/database/drivers/sqlite/sqlite_driver.php
@@ -279,7 +279,7 @@ class CI_DB_sqlite_driver extends CI_DB {
{
$sql = "SELECT name from sqlite_master WHERE type='table'";
- if ($prefix_limit !== FALSE AND $this->dbprefix != '')
+ if ($prefix_limit !== FALSE AND $this->dbprefix !== '')
{
$sql .= " AND 'name' LIKE '".$this->escape_like_str($this->dbprefix)."%' ".sprintf($this->_like_escape_str, $this->_like_escape_chr);
}
@@ -404,7 +404,7 @@ class CI_DB_sqlite_driver extends CI_DB {
*/
protected function _limit($sql, $limit, $offset)
{
- if ($offset == 0)
+ if ($offset === 0)
{
$offset = '';
}
diff --git a/system/database/drivers/sqlite/sqlite_forge.php b/system/database/drivers/sqlite/sqlite_forge.php
index dd6f0f78d..35be1b74b 100644
--- a/system/database/drivers/sqlite/sqlite_forge.php
+++ b/system/database/drivers/sqlite/sqlite_forge.php
@@ -194,7 +194,7 @@ class CI_DB_sqlite_forge extends CI_DB_forge {
$sql = 'ALTER TABLE '.$this->db->protect_identifiers($table).' '.$alter_type.' '.$this->db->protect_identifiers($column_name);
// DROP has everything it needs now.
- if ($alter_type == 'DROP')
+ if ($alter_type === 'DROP')
{
// SQLite does not support dropping columns
// http://www.sqlite.org/omitted.html
@@ -204,7 +204,7 @@ class CI_DB_sqlite_forge extends CI_DB_forge {
$sql .= " $column_definition";
- if ($default_value != '')
+ if ($default_value !== '')
{
$sql .= " DEFAULT \"$default_value\"";
}
@@ -218,7 +218,7 @@ class CI_DB_sqlite_forge extends CI_DB_forge {
$sql .= ' NOT NULL';
}
- if ($after_field != '')
+ if ($after_field !== '')
{
return $sql.' AFTER '.$this->db->protect_identifiers($after_field);
}
diff --git a/system/database/drivers/sqlite3/sqlite3_driver.php b/system/database/drivers/sqlite3/sqlite3_driver.php
index ea4cf2d4f..ea7e6d43c 100644
--- a/system/database/drivers/sqlite3/sqlite3_driver.php
+++ b/system/database/drivers/sqlite3/sqlite3_driver.php
@@ -255,7 +255,7 @@ class CI_DB_sqlite3_driver extends CI_DB {
protected function _list_tables($prefix_limit = FALSE)
{
return 'SELECT "NAME" FROM "SQLITE_MASTER" WHERE "TYPE" = \'table\''
- .(($prefix_limit !== FALSE && $this->dbprefix != '')
+ .(($prefix_limit !== FALSE && $this->dbprefix !== '')
? ' AND "NAME" LIKE \''.$this->escape_like_str($this->dbprefix).'%\' '.sprintf($this->_like_escape_str, $this->_like_escape_chr)
: '');
}
diff --git a/system/database/drivers/sqlite3/sqlite3_forge.php b/system/database/drivers/sqlite3/sqlite3_forge.php
index 20f1e6f63..0a5dc9211 100644
--- a/system/database/drivers/sqlite3/sqlite3_forge.php
+++ b/system/database/drivers/sqlite3/sqlite3_forge.php
@@ -184,7 +184,7 @@ class CI_DB_sqlite3_forge extends CI_DB_forge {
return 'ALTER TABLE '.$this->db->protect_identifiers($table).' '.$alter_type.' '.$this->db->protect_identifiers($column_name)
.' '.$column_definition
- .($default_value != '' ? ' DEFAULT '.$default_value : '')
+ .($default_value !== '' ? ' DEFAULT '.$default_value : '')
// If NOT NULL is specified, the field must have a DEFAULT value other than NULL
.(($null !== NULL && $default_value !== 'NULL') ? ' NOT NULL' : ' NULL');
}
diff --git a/system/database/drivers/sqlsrv/sqlsrv_forge.php b/system/database/drivers/sqlsrv/sqlsrv_forge.php
index c817c2c5d..1529b2a21 100644
--- a/system/database/drivers/sqlsrv/sqlsrv_forge.php
+++ b/system/database/drivers/sqlsrv/sqlsrv_forge.php
@@ -155,21 +155,21 @@ class CI_DB_sqlsrv_forge extends CI_DB_forge {
$sql = 'ALTER TABLE '.$this->db->protect_identifiers($table).' '.$alter_type.' '.$this->db->protect_identifiers($column_name);
// DROP has everything it needs now.
- if ($alter_type == 'DROP')
+ if ($alter_type === 'DROP')
{
return $sql;
}
$sql .= ' '.$column_definition;
- if ($default_value != '')
+ if ($default_value !== '')
{
$sql .= " DEFAULT '".$default_value."'";
}
$sql .= ($null === NULL) ? ' NULL' : ' NOT NULL';
- if ($after_field != '')
+ if ($after_field !== '')
{
return $sql.' AFTER '.$this->db->protect_identifiers($after_field);
}