diff options
Diffstat (limited to 'system/database/drivers')
28 files changed, 193 insertions, 143 deletions
diff --git a/system/database/drivers/mssql/mssql_driver.php b/system/database/drivers/mssql/mssql_driver.php index 5048c0b4a..56ecf32d1 100644 --- a/system/database/drivers/mssql/mssql_driver.php +++ b/system/database/drivers/mssql/mssql_driver.php @@ -1,4 +1,4 @@ -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); +<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); /** * CodeIgniter * @@ -267,9 +267,11 @@ class CI_DB_mssql_driver extends CI_DB { // escape LIKE condition wildcards if ($like === TRUE) { - $str = str_replace( array('%', '_', $this->_like_escape_chr), - array($this->_like_escape_chr.'%', $this->_like_escape_chr.'_', $this->_like_escape_chr.$this->_like_escape_chr), - $str); + $str = str_replace( + array($this->_like_escape_chr, '%', '_'), + array($this->_like_escape_chr.$this->_like_escape_chr, $this->_like_escape_chr.'%', $this->_like_escape_chr.'_'), + $str + ); } return $str; diff --git a/system/database/drivers/mssql/mssql_forge.php b/system/database/drivers/mssql/mssql_forge.php index 70b20ecf8..03151b24f 100644 --- a/system/database/drivers/mssql/mssql_forge.php +++ b/system/database/drivers/mssql/mssql_forge.php @@ -1,4 +1,4 @@ -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); +<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); /** * CodeIgniter * @@ -103,7 +103,7 @@ class CI_DB_mssql_forge extends CI_DB_forge { $sql .= "\n\t".$this->db->_protect_identifiers($field); - $sql .= ' '.$attributes['TYPE']; + $sql .= ' '.$attributes['TYPE']; if (array_key_exists('CONSTRAINT', $attributes)) { diff --git a/system/database/drivers/mssql/mssql_result.php b/system/database/drivers/mssql/mssql_result.php index 2897ca5a5..f1f6dbb84 100644 --- a/system/database/drivers/mssql/mssql_result.php +++ b/system/database/drivers/mssql/mssql_result.php @@ -1,4 +1,4 @@ -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); +<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); /** * CodeIgniter * @@ -120,7 +120,7 @@ class CI_DB_mssql_result extends CI_DB_result { /** * Data Seek * - * Moves the internal pointer to the desired offset. We call + * Moves the internal pointer to the desired offset. We call * this internally before fetching results to make sure the * result set starts at zero * diff --git a/system/database/drivers/mssql/mssql_utility.php b/system/database/drivers/mssql/mssql_utility.php index 48ecbc72a..3ee4d4b8f 100644 --- a/system/database/drivers/mssql/mssql_utility.php +++ b/system/database/drivers/mssql/mssql_utility.php @@ -1,4 +1,4 @@ -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); +<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); /** * CodeIgniter * diff --git a/system/database/drivers/mysql/mysql_driver.php b/system/database/drivers/mysql/mysql_driver.php index 4ff9b0a11..dec15863f 100644 --- a/system/database/drivers/mysql/mysql_driver.php +++ b/system/database/drivers/mysql/mysql_driver.php @@ -1,4 +1,4 @@ -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); +<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); /** * CodeIgniter * @@ -132,7 +132,22 @@ class CI_DB_mysql_driver extends CI_DB { */ function db_set_charset($charset, $collation) { - return @mysql_query("SET NAMES '".$this->escape_str($charset)."' COLLATE '".$this->escape_str($collation)."'", $this->conn_id); + static $use_set_names; + + if ( ! isset($use_set_names)) + { + // mysql_set_charset() requires PHP >= 5.2.3 and MySQL >= 5.0.7, use SET NAMES as fallback + $use_set_names = (version_compare(PHP_VERSION, '5.2.3', '>=') && version_compare(mysql_get_server_info(), '5.0.7', '>=')) ? FALSE : TRUE; + } + + if ($use_set_names) + { + return @mysql_query("SET NAMES '".$this->escape_str($charset)."' COLLATE '".$this->escape_str($collation)."'", $this->conn_id); + } + else + { + return @mysql_set_charset($charset, $this->conn_id); + } } // -------------------------------------------------------------------- @@ -287,12 +302,12 @@ class CI_DB_mysql_driver extends CI_DB { if (is_array($str)) { foreach ($str as $key => $val) - { + { $str[$key] = $this->escape_str($val, $like); - } + } - return $str; - } + return $str; + } if (function_exists('mysql_real_escape_string') AND is_resource($this->conn_id)) { @@ -635,7 +650,7 @@ class CI_DB_mysql_driver extends CI_DB { { if ($field != $index) { - $final[$field][] = 'WHEN '.$index.' = '.$val[$index].' THEN '.$val[$field]; + $final[$field][] = 'WHEN '.$index.' = '.$val[$index].' THEN '.$val[$field]; } } } diff --git a/system/database/drivers/mysql/mysql_forge.php b/system/database/drivers/mysql/mysql_forge.php index 529ec980d..5328a7b4e 100644 --- a/system/database/drivers/mysql/mysql_forge.php +++ b/system/database/drivers/mysql/mysql_forge.php @@ -1,4 +1,4 @@ -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); +<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); /** * CodeIgniter * @@ -86,7 +86,7 @@ class CI_DB_mysql_forge extends CI_DB_forge { if (array_key_exists('TYPE', $attributes)) { - $sql .= ' '.$attributes['TYPE']; + $sql .= ' '.$attributes['TYPE']; if (array_key_exists('CONSTRAINT', $attributes)) { diff --git a/system/database/drivers/mysql/mysql_result.php b/system/database/drivers/mysql/mysql_result.php index 507389603..19875ba9d 100644 --- a/system/database/drivers/mysql/mysql_result.php +++ b/system/database/drivers/mysql/mysql_result.php @@ -1,4 +1,4 @@ -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); +<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); /** * CodeIgniter * @@ -120,7 +120,7 @@ class CI_DB_mysql_result extends CI_DB_result { /** * Data Seek * - * Moves the internal pointer to the desired offset. We call + * Moves the internal pointer to the desired offset. We call * this internally before fetching results to make sure the * result set starts at zero * diff --git a/system/database/drivers/mysql/mysql_utility.php b/system/database/drivers/mysql/mysql_utility.php index e9747c540..5ce384c81 100644 --- a/system/database/drivers/mysql/mysql_utility.php +++ b/system/database/drivers/mysql/mysql_utility.php @@ -1,4 +1,4 @@ -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); +<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); /** * CodeIgniter * @@ -137,7 +137,7 @@ class CI_DB_mysql_utility extends CI_DB_utility { } // Fetch the field names and determine if the field is an - // integer type. We use this info to decide whether to + // integer type. We use this info to decide whether to // surround the data with quotes or not $i = 0; diff --git a/system/database/drivers/mysqli/mysqli_driver.php b/system/database/drivers/mysqli/mysqli_driver.php index ccdabce1a..74f55c421 100644 --- a/system/database/drivers/mysqli/mysqli_driver.php +++ b/system/database/drivers/mysqli/mysqli_driver.php @@ -1,4 +1,4 @@ -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); +<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); /** * CodeIgniter * @@ -132,7 +132,22 @@ class CI_DB_mysqli_driver extends CI_DB { */ function _db_set_charset($charset, $collation) { - return @mysqli_query($this->conn_id, "SET NAMES '".$this->escape_str($charset)."' COLLATE '".$this->escape_str($collation)."'"); + static $use_set_names; + + if ( ! isset($use_set_names)) + { + // mysqli_set_charset() requires MySQL >= 5.0.7, use SET NAMES as fallback + $use_set_names = (version_compare(mysqli_get_server_info($this->conn_id), '5.0.7', '>=')) ? FALSE : TRUE; + } + + if ($use_set_names) + { + return @mysqli_query($this->conn_id, "SET NAMES '".$this->escape_str($charset)."' COLLATE '".$this->escape_str($collation)."'"); + } + else + { + return @mysqli_set_charset($this->conn_id, $charset); + } } // -------------------------------------------------------------------- @@ -553,7 +568,7 @@ class CI_DB_mysqli_driver extends CI_DB { { return "INSERT INTO ".$table." (".implode(', ', $keys).") VALUES ".implode(', ', $values); } - + // -------------------------------------------------------------------- /** @@ -615,7 +630,7 @@ class CI_DB_mysqli_driver extends CI_DB { { if ($field != $index) { - $final[$field][] = 'WHEN '.$index.' = '.$val[$index].' THEN '.$val[$field]; + $final[$field][] = 'WHEN '.$index.' = '.$val[$index].' THEN '.$val[$field]; } } } diff --git a/system/database/drivers/mysqli/mysqli_forge.php b/system/database/drivers/mysqli/mysqli_forge.php index d5097335e..6450968dd 100644 --- a/system/database/drivers/mysqli/mysqli_forge.php +++ b/system/database/drivers/mysqli/mysqli_forge.php @@ -1,4 +1,4 @@ -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); +<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); /** * CodeIgniter * @@ -86,7 +86,7 @@ class CI_DB_mysqli_forge extends CI_DB_forge { if (array_key_exists('TYPE', $attributes)) { - $sql .= ' '.$attributes['TYPE']; + $sql .= ' '.$attributes['TYPE']; } if (array_key_exists('CONSTRAINT', $attributes)) diff --git a/system/database/drivers/mysqli/mysqli_result.php b/system/database/drivers/mysqli/mysqli_result.php index c4d8f5d58..8b4613454 100644 --- a/system/database/drivers/mysqli/mysqli_result.php +++ b/system/database/drivers/mysqli/mysqli_result.php @@ -1,4 +1,4 @@ -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); +<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); /** * CodeIgniter * @@ -120,7 +120,7 @@ class CI_DB_mysqli_result extends CI_DB_result { /** * Data Seek * - * Moves the internal pointer to the desired offset. We call + * Moves the internal pointer to the desired offset. We call * this internally before fetching results to make sure the * result set starts at zero * diff --git a/system/database/drivers/mysqli/mysqli_utility.php b/system/database/drivers/mysqli/mysqli_utility.php index e17889b8c..5d1f1a6d9 100644 --- a/system/database/drivers/mysqli/mysqli_utility.php +++ b/system/database/drivers/mysqli/mysqli_utility.php @@ -1,4 +1,4 @@ -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); +<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); /** * CodeIgniter * diff --git a/system/database/drivers/oci8/oci8_driver.php b/system/database/drivers/oci8/oci8_driver.php index 14df104ff..3a05ce36c 100644 --- a/system/database/drivers/oci8/oci8_driver.php +++ b/system/database/drivers/oci8/oci8_driver.php @@ -1,4 +1,4 @@ -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); +<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); /** * CodeIgniter * @@ -6,7 +6,7 @@ * * @package CodeIgniter * @author ExpressionEngine Dev Team - * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc. + * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc. * @license http://codeigniter.com/user_guide/license.html * @link http://codeigniter.com * @since Version 1.0 @@ -23,7 +23,7 @@ * class is being used or not. * * @package CodeIgniter - * @subpackage Drivers + * @subpackage Drivers * @category Database * @author ExpressionEngine Dev Team * @link http://codeigniter.com/user_guide/database/ @@ -37,7 +37,7 @@ * * NOTE: this uses the PHP 4 oci methods * - * @author Kelly McArdle + * @author Kelly McArdle * */ @@ -74,8 +74,8 @@ class CI_DB_oci8_driver extends CI_DB { /** * Non-persistent database connection * - * @access private called by the base class - * @return resource + * @access private called by the base class + * @return resource */ function db_connect() { @@ -87,8 +87,8 @@ class CI_DB_oci8_driver extends CI_DB { /** * Persistent database connection * - * @access private called by the base class - * @return resource + * @access private called by the base class + * @return resource */ function db_pconnect() { @@ -116,8 +116,8 @@ class CI_DB_oci8_driver extends CI_DB { /** * Select the database * - * @access private called by the base class - * @return resource + * @access private called by the base class + * @return resource */ function db_select() { @@ -145,8 +145,8 @@ class CI_DB_oci8_driver extends CI_DB { /** * Version number query string * - * @access public - * @return string + * @access public + * @return string */ function _version() { @@ -158,9 +158,9 @@ class CI_DB_oci8_driver extends CI_DB { /** * Execute the query * - * @access private called by the base class - * @param string an SQL query - * @return resource + * @access private called by the base class + * @param string an SQL query + * @return resource */ function _execute($sql) { @@ -175,9 +175,9 @@ class CI_DB_oci8_driver extends CI_DB { /** * Generate a statement ID * - * @access private - * @param string an SQL query - * @return none + * @access private + * @param string an SQL query + * @return none */ function _set_stmt_id($sql) { @@ -194,9 +194,9 @@ class CI_DB_oci8_driver extends CI_DB { * * If needed, each database adapter can prep the query string * - * @access private called by execute() - * @param string an SQL query - * @return string + * @access private called by execute() + * @param string an SQL query + * @return string */ function _prep_query($sql) { @@ -206,10 +206,10 @@ class CI_DB_oci8_driver extends CI_DB { // -------------------------------------------------------------------- /** - * getCursor. Returns a cursor from the datbase + * getCursor. Returns a cursor from the datbase * - * @access public - * @return cursor id + * @access public + * @return cursor id */ function get_cursor() { @@ -220,19 +220,19 @@ class CI_DB_oci8_driver extends CI_DB { // -------------------------------------------------------------------- /** - * Stored Procedure. Executes a stored procedure + * Stored Procedure. Executes a stored procedure * - * @access public - * @param package package stored procedure is in - * @param procedure stored procedure to execute - * @param params array of parameters - * @return array + * @access public + * @param package package stored procedure is in + * @param procedure stored procedure to execute + * @param params array of parameters + * @return array * * params array keys * - * KEY OPTIONAL NOTES + * KEY OPTIONAL NOTES * name no the name of the parameter should be in :<param_name> format - * value no the value of the parameter. If this is an OUT or IN OUT parameter, + * value no the value of the parameter. If this is an OUT or IN OUT parameter, * this should be a reference to a variable * type yes the type of the parameter * length yes the max size of the parameter @@ -275,8 +275,8 @@ class CI_DB_oci8_driver extends CI_DB { /** * Bind parameters * - * @access private - * @return none + * @access private + * @return none */ function _bind_params($params) { @@ -386,10 +386,10 @@ class CI_DB_oci8_driver extends CI_DB { /** * Escape String * - * @access public - * @param string + * @access public + * @param string * @param bool whether or not the string will be used in a LIKE condition - * @return string + * @return string */ function escape_str($str, $like = FALSE) { @@ -421,8 +421,8 @@ class CI_DB_oci8_driver extends CI_DB { /** * Affected Rows * - * @access public - * @return integer + * @access public + * @return integer */ function affected_rows() { @@ -434,8 +434,8 @@ class CI_DB_oci8_driver extends CI_DB { /** * Insert ID * - * @access public - * @return integer + * @access public + * @return integer */ function insert_id() { @@ -451,9 +451,9 @@ class CI_DB_oci8_driver extends CI_DB { * Generates a platform-specific query string that counts all records in * the specified database * - * @access public - * @param string - * @return string + * @access public + * @param string + * @return string */ function count_all($table = '') { @@ -480,9 +480,9 @@ class CI_DB_oci8_driver extends CI_DB { * * Generates a platform-specific query string so that the table names can be fetched * - * @access private + * @access private * @param boolean - * @return string + * @return string */ function _list_tables($prefix_limit = FALSE) { @@ -503,9 +503,9 @@ class CI_DB_oci8_driver extends CI_DB { * * Generates a platform-specific query string so that the column names can be fetched * - * @access public - * @param string the table name - * @return string + * @access public + * @param string the table name + * @return string */ function _list_columns($table = '') { @@ -519,9 +519,9 @@ class CI_DB_oci8_driver extends CI_DB { * * Generates a platform-specific query so that the column data can be retrieved * - * @access public - * @param string the table name - * @return object + * @access public + * @param string the table name + * @return object */ function _field_data($table) { @@ -533,8 +533,8 @@ class CI_DB_oci8_driver extends CI_DB { /** * The error message string * - * @access private - * @return string + * @access private + * @return string */ function _error_message() { @@ -547,8 +547,8 @@ class CI_DB_oci8_driver extends CI_DB { /** * The error message number * - * @access private - * @return integer + * @access private + * @return integer */ function _error_number() { @@ -627,11 +627,11 @@ class CI_DB_oci8_driver extends CI_DB { * * Generates a platform-specific insert string from the supplied data * - * @access public - * @param string the table name - * @param array the insert keys - * @param array the insert values - * @return string + * @access public + * @param string the table name + * @param array the insert keys + * @param array the insert values + * @return string */ function _insert($table, $keys, $values) { @@ -732,11 +732,11 @@ class CI_DB_oci8_driver extends CI_DB { * * Generates a platform-specific LIMIT clause * - * @access public - * @param string the sql query string - * @param integer the number of rows to limit the query to - * @param integer the offset value - * @return string + * @access public + * @param string the sql query string + * @param integer the number of rows to limit the query to + * @param integer the offset value + * @return string */ function _limit($sql, $limit, $offset) { @@ -759,9 +759,9 @@ class CI_DB_oci8_driver extends CI_DB { /** * Close DB Connection * - * @access public - * @param resource - * @return void + * @access public + * @param resource + * @return void */ function _close($conn_id) { diff --git a/system/database/drivers/oci8/oci8_forge.php b/system/database/drivers/oci8/oci8_forge.php index 3cd17585a..589e3c29d 100644 --- a/system/database/drivers/oci8/oci8_forge.php +++ b/system/database/drivers/oci8/oci8_forge.php @@ -1,4 +1,4 @@ -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); +<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); /** * CodeIgniter * @@ -90,7 +90,7 @@ class CI_DB_oci8_forge extends CI_DB_forge { $sql .= "\n\t".$this->db->_protect_identifiers($field); - $sql .= ' '.$attributes['TYPE']; + $sql .= ' '.$attributes['TYPE']; if (array_key_exists('CONSTRAINT', $attributes)) { diff --git a/system/database/drivers/oci8/oci8_result.php b/system/database/drivers/oci8/oci8_result.php index 88531b436..60d8396ef 100644 --- a/system/database/drivers/oci8/oci8_result.php +++ b/system/database/drivers/oci8/oci8_result.php @@ -1,4 +1,4 @@ -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); +<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); /** * CodeIgniter * @@ -6,7 +6,7 @@ * * @package CodeIgniter * @author ExpressionEngine Dev Team - * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc. + * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc. * @license http://codeigniter.com/user_guide/license.html * @link http://codeigniter.com * @since Version 1.0 @@ -37,8 +37,8 @@ class CI_DB_oci8_result extends CI_DB_result { * so we have to use what amounts to a hack. * * - * @access public - * @return integer + * @access public + * @return integer */ function num_rows() { @@ -58,8 +58,8 @@ class CI_DB_oci8_result extends CI_DB_result { /** * Number of fields in the result set * - * @access public - * @return integer + * @access public + * @return integer */ function num_fields() { @@ -102,8 +102,8 @@ class CI_DB_oci8_result extends CI_DB_result { * * Generates an array of objects containing field meta-data * - * @access public - * @return array + * @access public + * @return array */ function field_data() { @@ -114,7 +114,7 @@ class CI_DB_oci8_result extends CI_DB_result { $F = new stdClass(); $F->name = ocicolumnname($this->stmt_id, $c); $F->type = ocicolumntype($this->stmt_id, $c); - $F->max_length = ocicolumnsize($this->stmt_id, $c); + $F->max_length = ocicolumnsize($this->stmt_id, $c); $retval[] = $F; } @@ -145,8 +145,8 @@ class CI_DB_oci8_result extends CI_DB_result { * * Returns the result set as an array * - * @access private - * @return array + * @access private + * @return array */ function _fetch_assoc(&$row) { @@ -162,8 +162,8 @@ class CI_DB_oci8_result extends CI_DB_result { * * Returns the result set as an object * - * @access private - * @return object + * @access private + * @return object */ function _fetch_object() { @@ -202,10 +202,10 @@ class CI_DB_oci8_result extends CI_DB_result { // -------------------------------------------------------------------- /** - * Query result. "array" version. + * Query result. "array" version. * - * @access public - * @return array + * @access public + * @return array */ function result_array() { @@ -230,7 +230,7 @@ class CI_DB_oci8_result extends CI_DB_result { /** * Data Seek * - * Moves the internal pointer to the desired offset. We call + * Moves the internal pointer to the desired offset. We call * this internally before fetching results to make sure the * result set starts at zero * diff --git a/system/database/drivers/oci8/oci8_utility.php b/system/database/drivers/oci8/oci8_utility.php index 854b467e1..f1fe5dc00 100644 --- a/system/database/drivers/oci8/oci8_utility.php +++ b/system/database/drivers/oci8/oci8_utility.php @@ -1,4 +1,4 @@ -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); +<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); /** * CodeIgniter * diff --git a/system/database/drivers/odbc/odbc_driver.php b/system/database/drivers/odbc/odbc_driver.php index 81e0d7cf2..4268ccd94 100644 --- a/system/database/drivers/odbc/odbc_driver.php +++ b/system/database/drivers/odbc/odbc_driver.php @@ -1,4 +1,4 @@ -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); +<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); /** * CodeIgniter * diff --git a/system/database/drivers/odbc/odbc_forge.php b/system/database/drivers/odbc/odbc_forge.php index 3ec86b4e9..7e9414cc4 100644 --- a/system/database/drivers/odbc/odbc_forge.php +++ b/system/database/drivers/odbc/odbc_forge.php @@ -1,4 +1,4 @@ -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); +<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); /** * CodeIgniter * @@ -102,7 +102,7 @@ class CI_DB_odbc_forge extends CI_DB_forge { $sql .= "\n\t".$this->db->_protect_identifiers($field); - $sql .= ' '.$attributes['TYPE']; + $sql .= ' '.$attributes['TYPE']; if (array_key_exists('CONSTRAINT', $attributes)) { diff --git a/system/database/drivers/odbc/odbc_result.php b/system/database/drivers/odbc/odbc_result.php index 5d64a464f..d83b2e5f0 100644 --- a/system/database/drivers/odbc/odbc_result.php +++ b/system/database/drivers/odbc/odbc_result.php @@ -1,4 +1,4 @@ -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); +<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); /** * CodeIgniter * @@ -120,7 +120,7 @@ class CI_DB_odbc_result extends CI_DB_result { /** * Data Seek * - * Moves the internal pointer to the desired offset. We call + * Moves the internal pointer to the desired offset. We call * this internally before fetching results to make sure the * result set starts at zero * diff --git a/system/database/drivers/odbc/odbc_utility.php b/system/database/drivers/odbc/odbc_utility.php index d335bed99..424958b43 100644 --- a/system/database/drivers/odbc/odbc_utility.php +++ b/system/database/drivers/odbc/odbc_utility.php @@ -1,4 +1,4 @@ -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); +<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); /** * CodeIgniter * diff --git a/system/database/drivers/postgre/postgre_driver.php b/system/database/drivers/postgre/postgre_driver.php index 47ff36246..43d4d4d28 100644 --- a/system/database/drivers/postgre/postgre_driver.php +++ b/system/database/drivers/postgre/postgre_driver.php @@ -1,4 +1,4 @@ -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); +<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); /** * CodeIgniter * @@ -554,6 +554,24 @@ class CI_DB_postgre_driver extends CI_DB { // -------------------------------------------------------------------- /** + * Insert_batch statement + * + * Generates a platform-specific insert string from the supplied data + * + * @access public + * @param string the table name + * @param array the insert keys + * @param array the insert values + * @return string + */ + function _insert_batch($table, $keys, $values) + { + return "INSERT INTO ".$table." (".implode(', ', $keys).") VALUES ".implode(', ', $values); + } + + // -------------------------------------------------------------------- + + /** * Update statement * * Generates a platform-specific update string from the supplied data diff --git a/system/database/drivers/postgre/postgre_forge.php b/system/database/drivers/postgre/postgre_forge.php index 91a1c6861..fbfaac864 100644 --- a/system/database/drivers/postgre/postgre_forge.php +++ b/system/database/drivers/postgre/postgre_forge.php @@ -1,4 +1,4 @@ -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); +<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); /** * CodeIgniter * @@ -128,14 +128,14 @@ class CI_DB_postgre_forge extends CI_DB_forge { } // If this is an auto-incrementing primary key, use the serial data type instead - if (in_array($field, $primary_keys) && array_key_exists('AUTO_INCREMENT', $attributes) + if (in_array($field, $primary_keys) && array_key_exists('AUTO_INCREMENT', $attributes) && $attributes['AUTO_INCREMENT'] === TRUE) { $sql .= ' SERIAL'; } else { - $sql .= ' '.$attributes['TYPE']; + $sql .= ' '.$attributes['TYPE']; } // Modified to prevent constraints with integer data types @@ -213,8 +213,8 @@ class CI_DB_postgre_forge extends CI_DB_forge { /** * Drop Table * - * @access private - * @return bool + * @access private + * @return bool */ function _drop_table($table) { diff --git a/system/database/drivers/postgre/postgre_result.php b/system/database/drivers/postgre/postgre_result.php index e9a1d1607..e73a2583a 100644 --- a/system/database/drivers/postgre/postgre_result.php +++ b/system/database/drivers/postgre/postgre_result.php @@ -1,4 +1,4 @@ -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); +<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); /** * CodeIgniter * @@ -120,7 +120,7 @@ class CI_DB_postgre_result extends CI_DB_result { /** * Data Seek * - * Moves the internal pointer to the desired offset. We call + * Moves the internal pointer to the desired offset. We call * this internally before fetching results to make sure the * result set starts at zero * diff --git a/system/database/drivers/postgre/postgre_utility.php b/system/database/drivers/postgre/postgre_utility.php index 741c52ea8..c7690fc8f 100644 --- a/system/database/drivers/postgre/postgre_utility.php +++ b/system/database/drivers/postgre/postgre_utility.php @@ -1,4 +1,4 @@ -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); +<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); /** * CodeIgniter * diff --git a/system/database/drivers/sqlite/sqlite_driver.php b/system/database/drivers/sqlite/sqlite_driver.php index eb4e585b3..17b5f513c 100644 --- a/system/database/drivers/sqlite/sqlite_driver.php +++ b/system/database/drivers/sqlite/sqlite_driver.php @@ -1,4 +1,4 @@ -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); +<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); /** * CodeIgniter * diff --git a/system/database/drivers/sqlite/sqlite_forge.php b/system/database/drivers/sqlite/sqlite_forge.php index 56904082e..c1f8099dd 100644 --- a/system/database/drivers/sqlite/sqlite_forge.php +++ b/system/database/drivers/sqlite/sqlite_forge.php @@ -1,4 +1,4 @@ -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); +<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); /** * CodeIgniter * @@ -100,7 +100,7 @@ class CI_DB_sqlite_forge extends CI_DB_forge { $sql .= "\n\t".$this->db->_protect_identifiers($field); - $sql .= ' '.$attributes['TYPE']; + $sql .= ' '.$attributes['TYPE']; if (array_key_exists('CONSTRAINT', $attributes)) { @@ -172,7 +172,7 @@ class CI_DB_sqlite_forge extends CI_DB_forge { /** * Drop Table * - * Unsupported feature in SQLite + * Unsupported feature in SQLite * * @access private * @return bool diff --git a/system/database/drivers/sqlite/sqlite_result.php b/system/database/drivers/sqlite/sqlite_result.php index 7bd30db7c..62204946c 100644 --- a/system/database/drivers/sqlite/sqlite_result.php +++ b/system/database/drivers/sqlite/sqlite_result.php @@ -1,4 +1,4 @@ -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); +<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); /** * CodeIgniter * @@ -116,7 +116,7 @@ class CI_DB_sqlite_result extends CI_DB_result { /** * Data Seek * - * Moves the internal pointer to the desired offset. We call + * Moves the internal pointer to the desired offset. We call * this internally before fetching results to make sure the * result set starts at zero * diff --git a/system/database/drivers/sqlite/sqlite_utility.php b/system/database/drivers/sqlite/sqlite_utility.php index 508023e2f..bd741dd79 100644 --- a/system/database/drivers/sqlite/sqlite_utility.php +++ b/system/database/drivers/sqlite/sqlite_utility.php @@ -1,4 +1,4 @@ -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); +<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); /** * CodeIgniter * @@ -28,7 +28,7 @@ class CI_DB_sqlite_utility extends CI_DB_utility { * List databases * * I don't believe you can do a database listing with SQLite - * since each database is its own file. I suppose we could + * since each database is its own file. I suppose we could * try reading a directory looking for SQLite files, but * that doesn't seem like a terribly good idea * |