Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Some structural changes

  • Loading branch information...
commit e97ac563e6b90154dc0b1aa32ba99f61b9753d0c 1 parent fa4af2c
@narfbg narfbg authored
Showing with 277 additions and 537 deletions.
  1. +13 −4 system/core/Loader.php
  2. +43 −19 system/database/DB.php
  3. +11 −10 system/database/DB_driver.php
  4. +0 −160 system/database/drivers/mssql/mssql_forge.php
  5. +0 −201 system/database/drivers/mysqli/mysqli_forge.php
  6. 0  system/database/drivers/{ → native}/cubrid/cubrid_utility.php
  7. 0  system/database/drivers/{sqlsrv → native/cubrid}/index.html
  8. +3 −2 system/database/drivers/{cubrid → native}/cubrid_driver.php
  9. +2 −2 system/database/drivers/{cubrid → native}/cubrid_result.php
  10. 0  system/database/drivers/{ → native}/ibase/ibase_utility.php
  11. 0  system/database/drivers/{sqlite3 → native/ibase}/index.html
  12. +3 −2 system/database/drivers/{ibase → native}/ibase_driver.php
  13. +2 −2 system/database/drivers/{ibase → native}/ibase_result.php
  14. 0  system/database/drivers/{postgre → native}/index.html
  15. 0  system/database/drivers/{pdo/subdrivers → native/mssql}/index.html
  16. 0  system/database/drivers/{ → native}/mssql/mssql_utility.php
  17. +3 −2 system/database/drivers/{mssql → native}/mssql_driver.php
  18. +2 −2 system/database/drivers/{mssql → native}/mssql_result.php
  19. 0  system/database/drivers/{oci8 → native/mysqli}/index.html
  20. 0  system/database/drivers/{ → native}/mysqli/mysqli_utility.php
  21. +3 −2 system/database/drivers/{mysqli → native}/mysqli_driver.php
  22. +2 −2 system/database/drivers/{mysqli → native}/mysqli_result.php
  23. 0  system/database/drivers/{mysqli → native/oci8}/index.html
  24. 0  system/database/drivers/{ → native}/oci8/oci8_utility.php
  25. +3 −2 system/database/drivers/{oci8 → native}/oci8_driver.php
  26. +2 −2 system/database/drivers/{oci8 → native}/oci8_result.php
  27. 0  system/database/drivers/{mssql → native/postgre}/index.html
  28. 0  system/database/drivers/{ → native}/postgre/postgre_utility.php
  29. +3 −2 system/database/drivers/{postgre → native}/postgre_driver.php
  30. +3 −3 system/database/drivers/{postgre → native}/postgre_result.php
  31. 0  system/database/drivers/{ibase → native/sqlite3}/index.html
  32. 0  system/database/drivers/{ → native}/sqlite3/sqlite3_utility.php
  33. +3 −2 system/database/drivers/{sqlite3 → native}/sqlite3_driver.php
  34. +2 −2 system/database/drivers/{sqlite3 → native}/sqlite3_result.php
  35. 0  system/database/drivers/{cubrid → native/sqlsrv}/index.html
  36. 0  system/database/drivers/{ → native}/sqlsrv/sqlsrv_utility.php
  37. +3 −2 system/database/drivers/{sqlsrv → native}/sqlsrv_driver.php
  38. +2 −2 system/database/drivers/{sqlsrv → native}/sqlsrv_result.php
  39. +72 −0 system/database/drivers/native_driver.php
  40. +4 −3 system/database/drivers/pdo/{subdrivers/pdo_4d_driver.php → 4d_driver.php}
  41. +4 −3 system/database/drivers/pdo/{subdrivers/pdo_cubrid_driver.php → cubrid_driver.php}
  42. +5 −6 system/database/drivers/pdo/{subdrivers/pdo_dblib_driver.php → dblib_driver.php}
  43. +4 −3 system/database/drivers/pdo/{subdrivers/pdo_firebird_driver.php → firebird_driver.php}
  44. +4 −3 system/database/drivers/pdo/{subdrivers/pdo_ibm_driver.php → ibm_driver.php}
  45. +4 −3 system/database/drivers/pdo/{subdrivers/pdo_informix_driver.php → informix_driver.php}
  46. +4 −3 system/database/drivers/pdo/{subdrivers/pdo_mysql_driver.php → mysql_driver.php}
  47. +4 −3 system/database/drivers/pdo/{subdrivers/pdo_oci_driver.php → oci_driver.php}
  48. +3 −3 system/database/drivers/pdo/{subdrivers/pdo_odbc_driver.php → odbc_driver.php}
  49. +4 −3 system/database/drivers/pdo/{subdrivers/pdo_pgsql_driver.php → pgsql_driver.php}
  50. +4 −3 system/database/drivers/pdo/{subdrivers/pdo_sqlite_driver.php → sqlite_driver.php}
  51. +4 −3 system/database/drivers/pdo/{subdrivers/pdo_sqlsrv_driver.php → sqlsrv_driver.php}
  52. +8 −29 system/database/drivers/{pdo → }/pdo_driver.php
  53. +1 −1  system/database/drivers/{pdo → }/pdo_result.php
  54. +1 −1  system/database/{drivers/cubrid → forge}/cubrid_forge.php
  55. +4 −4 system/database/{drivers/ibase/ibase_forge.php → forge/firebird_forge.php}
  56. +10 −0 system/database/forge/index.html
  57. +4 −4 system/database/{drivers/sqlsrv/sqlsrv_forge.php → forge/mssql_forge.php}
  58. +1 −1  system/database/{drivers/mysql → forge}/mysql_forge.php
  59. +3 −3 system/database/{drivers/oci8/oci8_forge.php → forge/oracle_forge.php}
  60. +1 −1  system/database/{drivers/postgre → forge}/postgre_forge.php
  61. +4 −4 system/database/{drivers/sqlite3/sqlite3_forge.php → forge/sqlite_forge.php}
  62. +3 −3 tests/mocks/database/config/mysql.php
  63. +3 −6 tests/mocks/database/config/pdo/mysql.php
  64. +3 −6 tests/mocks/database/config/pdo/pgsql.php
  65. +3 −6 tests/mocks/database/config/pdo/sqlite.php
  66. +0 −2  tests/mocks/database/db.php
View
17 system/core/Loader.php
@@ -392,11 +392,20 @@ public function dbforge()
$CI =& get_instance();
- require_once(BASEPATH.'database/DB_forge.php');
- require_once(BASEPATH.'database/drivers/'.$CI->db->dbdriver.'/'.$CI->db->dbdriver.'_forge.php');
- $class = 'CI_DB_'.$CI->db->dbdriver.'_forge';
+ $class_name = 'CI_DB_'.$CI->db->platform.'_forge';
+ if (empty($CI->db->platform))
+ {
+ show_error('DB Forge is not supported for '.$CI->db->platform);
+ return;
+ }
+
+ if ( ! class_exists($class_name))
+ {
+ require_once(BASEPATH.'database/DB_forge.php');
+ require_once(BASEPATH.'database/forge/'.$CI->db->platform.'_forge.php');
+ }
- $CI->dbforge = new $class();
+ $CI->dbforge = new $class_name();
}
// --------------------------------------------------------------------
View
62 system/database/DB.php
@@ -156,33 +156,33 @@ class CI_DB extends CI_DB_query_builder { }
class CI_DB extends CI_DB_driver { }
}
- // Load the DB driver
- $driver_file = BASEPATH.'database/drivers/'.$params['dbdriver'].'/'.$params['dbdriver'].'_driver.php';
-
- if ( ! file_exists($driver_file))
+ // We might have the driver interface specified
+ if (isset($params['db_iface']))
{
- show_error('Invalid DB driver');
+ $driver_class = _DB_driver($params['db_iface'], $params['dbdriver']);
}
-
- require_once($driver_file);
-
- // Instantiate the DB adapter
- $driver = 'CI_DB_'.$params['dbdriver'].'_driver';
- $DB = new $driver($params);
-
- // Check for a subdriver
- if ( ! empty($DB->subdriver))
+ else
{
- $driver_file = BASEPATH.'database/drivers/'.$DB->dbdriver.'/subdrivers/'.$DB->dbdriver.'_'.$DB->subdriver.'_driver.php';
+ // If we don't have a (valid) PDO DSN - look for a native driver first.
+ $precedence = (empty($params['dsn']) OR ! preg_match('/^[a-z0-9]+\:[a-z]+\=.+/i', trim($params['dsn'])))
+ ? array('native', 'pdo')
+ : array('pdo', 'native');
- if (file_exists($driver_file))
+ foreach ($precedence as $driver_iface)
{
- require_once($driver_file);
- $driver = 'CI_DB_'.$DB->dbdriver.'_'.$DB->subdriver.'_driver';
- $DB = new $driver($params);
+ if (($driver_class = _DB_driver($driver_iface, $params['dbdriver'])) !== FALSE)
+ {
+ break;
+ }
}
}
+ if ($driver_class === FALSE)
+ {
+ show_error('Invalid DB driver');
+ }
+
+ $DB = new $driver_class($params);
if ($DB->autoinit === TRUE)
{
$DB->initialize();
@@ -196,5 +196,29 @@ class CI_DB extends CI_DB_driver { }
return $DB;
}
+/**
+ * Load driver file and return the DB driver class to instantiate
+ *
+ * @param string $iface 'pdo' or 'native'
+ * @param string $driver the driver name
+ * @return string class name
+ */
+function _DB_driver($iface, $driver)
+{
+ require_once(BASEPATH.'/database/drivers/'.$iface.'_driver.php');
+
+ $class_name = 'CI_DB_'.$iface.'_'.$driver.'_driver';
+ if ( ! class_exists('CI_DB_'.$iface.'_'.$driver.'_driver'))
+ {
+ $driver_file = BASEPATH.'/database/drivers/'.$iface.'/'.$driver.'_driver.php';
+ if ( ! file_exists($driver_file) OR ! include_once($driver_file))
+ {
+ return FALSE;
+ }
+ }
+
+ return $class_name;
+}
+
/* End of file DB.php */
/* Location: ./system/database/DB.php */
View
21 system/database/DB_driver.php
@@ -45,11 +45,12 @@
public $password;
public $hostname;
public $database;
- public $dbdriver = 'mysqli';
- public $subdriver;
+ public $dbdriver;
+ public $db_iface;
+ public $platform;
public $dbprefix = '';
- public $char_set = 'utf8';
- public $dbcollat = 'utf8_general_ci';
+ public $char_set;
+ public $dbcollat;
public $autoinit = TRUE; // Whether to automatically initialize the DB
public $swap_pre = '';
public $port = '';
@@ -339,7 +340,7 @@ public function query($sql, $binds = FALSE, $return_object = NULL)
// cached query if it exists
if ($this->cache_on === TRUE && $return_object === TRUE && $this->_cache_init())
{
- $this->load_rdriver();
+ $this->_load_rdriver();
if (FALSE !== ($cache = $this->CACHE->read($sql)))
{
return $cache;
@@ -418,7 +419,7 @@ public function query($sql, $binds = FALSE, $return_object = NULL)
}
// Load and instantiate the result driver
- $driver = $this->load_rdriver();
+ $driver = $this->_load_rdriver();
$RES = new $driver($this);
// Is query caching enabled? If so, we'll serialize the
@@ -453,14 +454,14 @@ public function query($sql, $binds = FALSE, $return_object = NULL)
*
* @return string the name of the result class
*/
- public function load_rdriver()
+ protected function _load_rdriver()
{
- $driver = 'CI_DB_'.$this->dbdriver.'_result';
+ $driver = 'CI_DB_'.$this->db_iface.'_result';
if ( ! class_exists($driver))
{
- include_once(BASEPATH.'database/DB_result.php');
- include_once(BASEPATH.'database/drivers/'.$this->dbdriver.'/'.$this->dbdriver.'_result.php');
+ require_once(BASEPATH.'database/DB_result.php');
+ require_once(BASEPATH.'database/drivers/'.$this->db_iface.'_result.php');
}
return $driver;
View
160 system/database/drivers/mssql/mssql_forge.php
@@ -1,160 +0,0 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
-/**
- * CodeIgniter
- *
- * An open source application development framework for PHP 5.2.4 or newer
- *
- * NOTICE OF LICENSE
- *
- * Licensed under the Open Software License version 3.0
- *
- * This source file is subject to the Open Software License (OSL 3.0) that is
- * bundled with this package in the files license.txt / license.rst. It is
- * also available through the world wide web at this URL:
- * http://opensource.org/licenses/OSL-3.0
- * If you did not receive a copy of the license and are unable to obtain it
- * through the world wide web, please send an email to
- * licensing@ellislab.com so we can send you a copy immediately.
- *
- * @package CodeIgniter
- * @author EllisLab Dev Team
- * @copyright Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
- * @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
- * @link http://codeigniter.com
- * @since Version 1.0
- * @filesource
- */
-
-/**
- * MS SQL Forge Class
- *
- * @category Database
- * @author EllisLab Dev Team
- * @link http://codeigniter.com/user_guide/database/
- */
-class CI_DB_mssql_forge extends CI_DB_forge {
-
- protected $_drop_table = 'DROP TABLE %s';
-
- /**
- * Create Table
- *
- * @param string the table name
- * @param array the fields
- * @param mixed primary key(s)
- * @param mixed key(s)
- * @param bool should 'IF NOT EXISTS' be added to the SQL
- * @return string
- */
- protected function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists)
- {
- $sql = ($if_not_exists === TRUE)
- ? "IF NOT EXISTS (SELECT * FROM sysobjects WHERE ID = object_id(N'".$table."') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)\n"
- : '';
-
- $sql .= 'CREATE TABLE '.$this->db->escape_identifiers($table).' (';
-
- $current_field_count = 0;
- foreach ($fields as $field => $attributes)
- {
- // Numeric field names aren't allowed in databases, so if the key is
- // numeric, we know it was assigned by PHP and the developer manually
- // entered the field information, so we'll simply add it to the list
- if (is_numeric($field))
- {
- $sql .= "\n\t".$attributes;
- }
- else
- {
- $attributes = array_change_key_case($attributes, CASE_UPPER);
-
- $sql .= "\n\t".$this->db->escape_identifiers($field).' '.$attributes['TYPE'];
-
- if (stripos($attributes['TYPE'], 'INT') === FALSE && ! empty($attributes['CONSTRAINT']))
- {
- $sql .= '('.$attributes['CONSTRAINT'].')';
- }
-
- if ( ! empty($attributes['UNSIGNED']) && $attributes['UNSIGNED'] === TRUE)
- {
- $sql .= ' UNSIGNED';
- }
-
- if (isset($attributes['DEFAULT']))
- {
- $sql .= " DEFAULT '".$attributes['DEFAULT']."'";
- }
-
- $sql .= ( ! empty($attributes['NULL']) && $attributes['NULL'] === TRUE)
- ? ' NULL' : ' NOT NULL';
-
- if ( ! empty($attributes['AUTO_INCREMENT']) && $attributes['AUTO_INCREMENT'] === TRUE)
- {
- $sql .= ' AUTO_INCREMENT';
- }
- }
-
- // don't add a comma on the end of the last field
- if (++$current_field_count < count($fields))
- {
- $sql .= ',';
- }
- }
-
- if (count($primary_keys) > 0)
- {
- $sql .= ",\n\tPRIMARY KEY (".implode(', ', $this->db->escape_identifiers($primary_keys)).')';
- }
-
- if (is_array($keys) && count($keys) > 0)
- {
- foreach ($keys as $key)
- {
- $key = is_array($key)
- ? $this->db->escape_identifiers($key)
- : array($this->db->escape_identifiers($key));
-
- $sql .= ",\n\tFOREIGN KEY (".implode(', ', $key).')';
- }
- }
-
- return $sql."\n)";
- }
-
- // --------------------------------------------------------------------
-
- /**
- * Alter table query
- *
- * Generates a platform-specific query so that a table can be altered
- * Called by add_column(), drop_column(), and column_alter(),
- *
- * @param string the ALTER type (ADD, DROP, CHANGE)
- * @param string the column name
- * @param string the table name
- * @param string the column definition
- * @param string the default value
- * @param bool should 'NOT NULL' be added
- * @param string the field after which we should add the new field
- * @return string
- */
- protected function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '')
- {
- $sql = 'ALTER TABLE '.$this->db->escape_identifiers($table).' '.$alter_type.' '.$this->db->escape_identifiers($column_name);
-
- // DROP has everything it needs now.
- if ($alter_type === 'DROP')
- {
- return $sql;
- }
-
- return $sql.' '.$column_definition
- .($default_value != '' ? ' DEFAULT "'.$default_value.'"' : '')
- .($null === NULL ? ' NULL' : ' NOT NULL')
- .($after_field != '' ? ' AFTER '.$this->db->escape_identifiers($after_field) : '');
- }
-
-}
-
-/* End of file mssql_forge.php */
-/* Location: ./system/database/drivers/mssql/mssql_forge.php */
View
201 system/database/drivers/mysqli/mysqli_forge.php
@@ -1,201 +0,0 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
-/**
- * CodeIgniter
- *
- * An open source application development framework for PHP 5.2.4 or newer
- *
- * NOTICE OF LICENSE
- *
- * Licensed under the Open Software License version 3.0
- *
- * This source file is subject to the Open Software License (OSL 3.0) that is
- * bundled with this package in the files license.txt / license.rst. It is
- * also available through the world wide web at this URL:
- * http://opensource.org/licenses/OSL-3.0
- * If you did not receive a copy of the license and are unable to obtain it
- * through the world wide web, please send an email to
- * licensing@ellislab.com so we can send you a copy immediately.
- *
- * @package CodeIgniter
- * @author EllisLab Dev Team
- * @copyright Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
- * @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
- * @link http://codeigniter.com
- * @since Version 1.0
- * @filesource
- */
-
-/**
- * MySQLi Forge Class
- *
- * @category Database
- * @author EllisLab Dev Team
- * @link http://codeigniter.com/user_guide/database/
- */
-class CI_DB_mysqli_forge extends CI_DB_forge {
-
- protected $_create_database = 'CREATE DATABASE %s CHARACTER SET %s COLLATE %s';
-
- /**
- * Process Fields
- *
- * @param mixed the fields
- * @return string
- */
- protected function _process_fields($fields)
- {
- $current_field_count = 0;
- $sql = '';
-
- foreach ($fields as $field => $attributes)
- {
- // Numeric field names aren't allowed in databases, so if the key is
- // numeric, we know it was assigned by PHP and the developer manually
- // entered the field information, so we'll simply add it to the list
- if (is_numeric($field))
- {
- $sql .= "\n\t".$attributes;
- }
- else
- {
- $attributes = array_change_key_case($attributes, CASE_UPPER);
-
- $sql .= "\n\t".$this->db->escape_identifiers($field);
-
- empty($attributes['NAME']) OR $sql .= ' '.$this->db->escape_identifiers($attributes['NAME']).' ';
-
- if ( ! empty($attributes['TYPE']))
- {
- $sql .= ' '.$attributes['TYPE'];
-
- if ( ! empty($attributes['CONSTRAINT']))
- {
- switch (strtolower($attributes['TYPE']))
- {
- case 'decimal':
- case 'float':
- case 'numeric':
- $sql .= '('.implode(',', $attributes['CONSTRAINT']).')';
- break;
- case 'enum':
- case 'set':
- $sql .= '("'.implode('","', $attributes['CONSTRAINT']).'")';
- break;
- default:
- $sql .= '('.$attributes['CONSTRAINT'].')';
- }
- }
- }
-
- if ( ! empty($attributes['UNSIGNED']) && $attributes['UNSIGNED'] === TRUE)
- {
- $sql .= ' UNSIGNED';
- }
-
- if (isset($attributes['DEFAULT']))
- {
- $sql .= " DEFAULT '".$attributes['DEFAULT']."'";
- }
-
- $sql .= ( ! empty($attributes['NULL']) && $attributes['NULL'] === TRUE)
- ? ' NULL' : ' NOT NULL';
-
- if ( ! empty($attributes['AUTO_INCREMENT']) && $attributes['AUTO_INCREMENT'] === TRUE)
- {
- $sql .= ' AUTO_INCREMENT';
- }
- }
-
- // don't add a comma on the end of the last field
- if (++$current_field_count < count($fields))
- {
- $sql .= ',';
- }
- }
-
- return $sql;
- }
-
- // --------------------------------------------------------------------
-
- /**
- * Create Table
- *
- * @param string the table name
- * @param mixed the fields
- * @param mixed primary key(s)
- * @param mixed key(s)
- * @param bool should 'IF NOT EXISTS' be added to the SQL
- * @return bool
- */
- protected function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists)
- {
- $sql = 'CREATE TABLE ';
-
- if ($if_not_exists === TRUE)
- {
- $sql .= 'IF NOT EXISTS ';
- }
-
- $sql .= $this->db->escape_identifiers($table).' ('.$this->_process_fields($fields);
-
- if (count($primary_keys) > 0)
- {
- $key_name = $this->db->escape_identifiers(implode('_', $primary_keys));
- $sql .= ",\n\tPRIMARY KEY ".$key_name.' ('.implode(', ', $this->db->escape_identifiers($primary_keys)).')';
- }
-
- if (is_array($keys) && count($keys) > 0)
- {
- foreach ($keys as $key)
- {
- if (is_array($key))
- {
- $key_name = $this->db->escape_identifiers(implode('_', $key));
- $key = $this->db->escape_identifiers($key);
- }
- else
- {
- $key_name = $this->db->escape_identifiers($key);
- $key = array($key_name);
- }
-
- $sql .= ",\n\tKEY ".$key_name.' ('.implode(', ', $key).')';
- }
- }
-
- return $sql."\n) DEFAULT CHARACTER SET ".$this->db->char_set.' COLLATE '.$this->db->dbcollat.';';
- }
-
- // --------------------------------------------------------------------
-
- /**
- * Alter table query
- *
- * Generates a platform-specific query so that a table can be altered
- * Called by add_column(), drop_column(), and column_alter(),
- *
- * @param string the ALTER type (ADD, DROP, CHANGE)
- * @param string the column name
- * @param array fields
- * @param string the field after which we should add the new field
- * @return string
- */
- protected function _alter_table($alter_type, $table, $fields, $after_field = '')
- {
- $sql = 'ALTER TABLE '.$this->db->escape_identifiers($table).' '.$alter_type.' ';
-
- // DROP has everything it needs now.
- if ($alter_type === 'DROP')
- {
- return $sql.$this->db->escape_identifiers($fields);
- }
-
- return $sql.$this->_process_fields($fields)
- .($after_field !== '' ? ' AFTER '.$this->db->escape_identifiers($after_field) : '');
- }
-
-}
-
-/* End of file mysqli_forge.php */
-/* Location: ./system/database/drivers/mysqli/mysqli_forge.php */
View
0  system/database/drivers/cubrid/cubrid_utility.php → ...database/drivers/native/cubrid/cubrid_utility.php
File renamed without changes
View
0  system/database/drivers/sqlsrv/index.html → system/database/drivers/native/cubrid/index.html
File renamed without changes
View
5 system/database/drivers/cubrid/cubrid_driver.php → system/database/drivers/native/cubrid_driver.php
@@ -38,9 +38,10 @@
* @author Esen Sagynov
* @link http://codeigniter.com/user_guide/database/
*/
-class CI_DB_cubrid_driver extends CI_DB {
+class CI_DB_native_cubrid_driver extends CI_DB_native_driver {
public $dbdriver = 'cubrid';
+ public $platform = 'cubrid';
// The character used for escaping - no need in CUBRID
protected $_escape_char = '`';
@@ -443,4 +444,4 @@ protected function _close()
}
/* End of file cubrid_driver.php */
-/* Location: ./system/database/drivers/cubrid/cubrid_driver.php */
View
4 system/database/drivers/cubrid/cubrid_result.php → system/database/drivers/native/cubrid_result.php
@@ -35,7 +35,7 @@
* @link http://codeigniter.com/user_guide/database/
* @since 2.1
*/
-class CI_DB_cubrid_result extends CI_DB_result {
+class CI_DB_native_cubrid_result extends CI_DB_result {
/**
* Number of rows in the result set
@@ -171,4 +171,4 @@ protected function _fetch_object($class_name = 'stdClass')
}
/* End of file cubrid_result.php */
-/* Location: ./system/database/drivers/cubrid/cubrid_result.php */
View
0  system/database/drivers/ibase/ibase_utility.php → ...m/database/drivers/native/ibase/ibase_utility.php
File renamed without changes
View
0  system/database/drivers/sqlite3/index.html → system/database/drivers/native/ibase/index.html
File renamed without changes
View
5 system/database/drivers/ibase/ibase_driver.php → system/database/drivers/native/ibase_driver.php
@@ -38,9 +38,10 @@
* @author EllisLab Dev Team
* @link http://codeigniter.com/user_guide/database/
*/
-class CI_DB_ibase_driver extends CI_DB {
+class CI_DB_native_ibase_driver extends CI_DB_native_driver {
public $dbdriver = 'ibase';
+ public $platform = 'firebird';
// The character used to escape with
protected $_escape_char = '"';
@@ -438,4 +439,4 @@ protected function _close()
}
/* End of file ibase_driver.php */
-/* Location: ./system/database/drivers/ibase/ibase_driver.php */
View
4 system/database/drivers/ibase/ibase_result.php → system/database/drivers/native/ibase_result.php
@@ -35,7 +35,7 @@
* @link http://codeigniter.com/user_guide/database/
* @since 3.0
*/
-class CI_DB_ibase_result extends CI_DB_result {
+class CI_DB_native_ibase_result extends CI_DB_result {
/**
* Number of fields in the result set
@@ -152,4 +152,4 @@ protected function _fetch_object($class_name = 'stdClass')
}
/* End of file ibase_result.php */
-/* Location: ./system/database/drivers/ibase/ibase_result.php */
View
0  system/database/drivers/postgre/index.html → system/database/drivers/native/index.html
File renamed without changes
View
0  system/database/drivers/pdo/subdrivers/index.html → system/database/drivers/native/mssql/index.html
File renamed without changes
View
0  system/database/drivers/mssql/mssql_utility.php → ...m/database/drivers/native/mssql/mssql_utility.php
File renamed without changes
View
5 system/database/drivers/mssql/mssql_driver.php → system/database/drivers/native/mssql_driver.php
@@ -38,9 +38,10 @@
* @author EllisLab Dev Team
* @link http://codeigniter.com/user_guide/database/
*/
-class CI_DB_mssql_driver extends CI_DB {
+class CI_DB_native_mssql_driver extends CI_DB_native_driver {
public $dbdriver = 'mssql';
+ public $platform = 'mssql';
// The character used for escaping
protected $_escape_char = '"';
@@ -511,4 +512,4 @@ protected function _close()
}
/* End of file mssql_driver.php */
-/* Location: ./system/database/drivers/mssql/mssql_driver.php */
View
4 system/database/drivers/mssql/mssql_result.php → system/database/drivers/native/mssql_result.php
@@ -35,7 +35,7 @@
* @link http://codeigniter.com/user_guide/database/
* @since 1.3
*/
-class CI_DB_mssql_result extends CI_DB_result {
+class CI_DB_native_mssql_result extends CI_DB_result {
/**
* Number of rows in the result set
@@ -185,4 +185,4 @@ protected function _fetch_object($class_name = 'stdClass')
}
/* End of file mssql_result.php */
-/* Location: ./system/database/drivers/mssql/mssql_result.php */
View
0  system/database/drivers/oci8/index.html → system/database/drivers/native/mysqli/index.html
File renamed without changes
View
0  system/database/drivers/mysqli/mysqli_utility.php → ...database/drivers/native/mysqli/mysqli_utility.php
File renamed without changes
View
5 system/database/drivers/mysqli/mysqli_driver.php → system/database/drivers/native/mysqli_driver.php
@@ -38,9 +38,10 @@
* @author EllisLab Dev Team
* @link http://codeigniter.com/user_guide/database/
*/
-class CI_DB_mysqli_driver extends CI_DB {
+class CI_DB_native_mysqli_driver extends CI_DB_native_driver {
public $dbdriver = 'mysqli';
+ public $platform = 'mysql';
// The character used for escaping
protected $_escape_char = '`';
@@ -461,4 +462,4 @@ protected function _close()
}
/* End of file mysqli_driver.php */
-/* Location: ./system/database/drivers/mysqli/mysqli_driver.php */
View
4 system/database/drivers/mysqli/mysqli_result.php → system/database/drivers/native/mysqli_result.php
@@ -35,7 +35,7 @@
* @link http://codeigniter.com/user_guide/database/
* @since 1.3
*/
-class CI_DB_mysqli_result extends CI_DB_result {
+class CI_DB_native_mysqli_result extends CI_DB_result {
/**
* Number of rows in the result set
@@ -171,4 +171,4 @@ protected function _fetch_object($class_name = 'stdClass')
}
/* End of file mysqli_result.php */
-/* Location: ./system/database/drivers/mysqli/mysqli_result.php */
View
0  system/database/drivers/mysqli/index.html → system/database/drivers/native/oci8/index.html
File renamed without changes
View
0  system/database/drivers/oci8/oci8_utility.php → system/database/drivers/native/oci8/oci8_utility.php
File renamed without changes
View
5 system/database/drivers/oci8/oci8_driver.php → system/database/drivers/native/oci8_driver.php
@@ -47,9 +47,10 @@
*
* @author Kelly McArdle
*/
-class CI_DB_oci8_driver extends CI_DB {
+class CI_DB_native_oci8_driver extends CI_DB_native_driver {
public $dbdriver = 'oci8';
+ public $platform = 'oracle';
// The character used for excaping
protected $_escape_char = '"';
@@ -661,4 +662,4 @@ protected function _close()
}
/* End of file oci8_driver.php */
-/* Location: ./system/database/drivers/oci8/oci8_driver.php */
View
4 system/database/drivers/oci8/oci8_result.php → system/database/drivers/native/oci8_result.php
@@ -35,7 +35,7 @@
* @link http://codeigniter.com/user_guide/database/
* @since 1.4.1
*/
-class CI_DB_oci8_result extends CI_DB_result {
+class CI_DB_native_oci8_result extends CI_DB_result {
public $stmt_id;
public $curs_id;
@@ -250,4 +250,4 @@ protected function _data_seek()
}
/* End of file oci8_result.php */
-/* Location: ./system/database/drivers/oci8/oci8_result.php */
View
0  system/database/drivers/mssql/index.html → system/database/drivers/native/postgre/index.html
File renamed without changes
View
0  system/database/drivers/postgre/postgre_utility.php → ...tabase/drivers/native/postgre/postgre_utility.php
File renamed without changes
View
5 system/database/drivers/postgre/postgre_driver.php → system/database/drivers/native/postgre_driver.php
@@ -38,9 +38,10 @@
* @author EllisLab Dev Team
* @link http://codeigniter.com/user_guide/database/
*/
-class CI_DB_postgre_driver extends CI_DB {
+class CI_DB_native_postgre_driver extends CI_DB_native_driver {
public $dbdriver = 'postgre';
+ public $platform = 'postgre';
protected $_escape_char = '"';
@@ -665,4 +666,4 @@ protected function _close()
}
/* End of file postgre_driver.php */
-/* Location: ./system/database/drivers/postgre/postgre_driver.php */
View
6 system/database/drivers/postgre/postgre_result.php → system/database/drivers/native/postgre_result.php
@@ -26,7 +26,7 @@
*/
/**
- * Postgres Result Class
+ * PostgreSQL Result Class
*
* This class extends the parent result class: CI_DB_result
*
@@ -35,7 +35,7 @@
* @link http://codeigniter.com/user_guide/database/
* @since 1.3
*/
-class CI_DB_postgre_result extends CI_DB_result {
+class CI_DB_native_postgre_result extends CI_DB_result {
/**
* Number of rows in the result set
@@ -170,4 +170,4 @@ protected function _fetch_object($class_name = 'stdClass')
}
/* End of file postgre_result.php */
-/* Location: ./system/database/drivers/postgre/postgre_result.php */
View
0  system/database/drivers/ibase/index.html → system/database/drivers/native/sqlite3/index.html
File renamed without changes
View
0  system/database/drivers/sqlite3/sqlite3_utility.php → ...tabase/drivers/native/sqlite3/sqlite3_utility.php
File renamed without changes
View
5 system/database/drivers/sqlite3/sqlite3_driver.php → system/database/drivers/native/sqlite3_driver.php
@@ -39,9 +39,10 @@
* @link http://codeigniter.com/user_guide/database/
* @since Version 3.0
*/
-class CI_DB_sqlite3_driver extends CI_DB {
+class CI_DB_native_sqlite3_driver extends CI_DB_native_driver {
public $dbdriver = 'sqlite3';
+ public $platform = 'sqlite';
// The character used for escaping
protected $_escape_char = '"';
@@ -359,4 +360,4 @@ protected function _close()
}
/* End of file sqlite3_driver.php */
-/* Location: ./system/database/drivers/sqlite3/sqlite3_driver.php */
View
4 system/database/drivers/sqlite3/sqlite3_result.php → system/database/drivers/native/sqlite3_result.php
@@ -35,7 +35,7 @@
* @link http://codeigniter.com/user_guide/database/
* @since 3.0
*/
-class CI_DB_sqlite3_result extends CI_DB_result {
+class CI_DB_native_sqlite3_result extends CI_DB_result {
// num_fields() might be called multiple times, so we'll use this one to cache it's result
protected $_num_fields;
@@ -178,4 +178,4 @@ protected function _data_seek($n = 0)
}
/* End of file sqlite3_result.php */
-/* Location: ./system/database/drivers/sqlite3/sqlite3_result.php */
View
0  system/database/drivers/cubrid/index.html → system/database/drivers/native/sqlsrv/index.html
File renamed without changes
View
0  system/database/drivers/sqlsrv/sqlsrv_utility.php → ...database/drivers/native/sqlsrv/sqlsrv_utility.php
File renamed without changes
View
5 system/database/drivers/sqlsrv/sqlsrv_driver.php → system/database/drivers/native/sqlsrv_driver.php
@@ -38,9 +38,10 @@
* @author EllisLab Dev Team
* @link http://codeigniter.com/user_guide/database/
*/
-class CI_DB_sqlsrv_driver extends CI_DB {
+class CI_DB_native_sqlsrv_driver extends CI_DB_native_driver {
public $dbdriver = 'sqlsrv';
+ public $platform = 'mssql';
// The character used for escaping
protected $_escape_char = '"';
@@ -506,4 +507,4 @@ protected function _close()
}
/* End of file sqlsrv_driver.php */
-/* Location: ./system/database/drivers/sqlsrv/sqlsrv_driver.php */
View
4 system/database/drivers/sqlsrv/sqlsrv_result.php → system/database/drivers/native/sqlsrv_result.php
@@ -35,7 +35,7 @@
* @link http://codeigniter.com/user_guide/database/
* @since 2.0.3
*/
-class CI_DB_sqlsrv_result extends CI_DB_result {
+class CI_DB_native_sqlsrv_result extends CI_DB_result {
/**
* Number of rows in the result set
@@ -156,4 +156,4 @@ protected function _fetch_object($class_name = 'stdClass')
}
/* End of file sqlsrv_result.php */
-/* Location: ./system/database/drivers/sqlsrv/sqlsrv_result.php */
View
72 system/database/drivers/native_driver.php
@@ -0,0 +1,72 @@
+<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 5.2.4 or newer
+ *
+ * NOTICE OF LICENSE
+ *
+ * Licensed under the Open Software License version 3.0
+ *
+ * This source file is subject to the Open Software License (OSL 3.0) that is
+ * bundled with this package in the files license.txt / license.rst. It is
+ * also available through the world wide web at this URL:
+ * http://opensource.org/licenses/OSL-3.0
+ * If you did not receive a copy of the license and are unable to obtain it
+ * through the world wide web, please send an email to
+ * licensing@ellislab.com so we can send you a copy immediately.
+ *
+ * @package CodeIgniter
+ * @author EllisLab Dev Team
+ * @copyright Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
+ * @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
+ * @link http://codeigniter.com
+ * @since Version 2.1.0
+ * @filesource
+ */
+
+/**
+ * Native Database Interface 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 Interfaces
+ * @category Database
+ * @author EllisLab Dev Team
+ * @link http://codeigniter.com/user_guide/database/
+ */
+abstract class CI_DB_native_driver extends CI_DB {
+
+ // The character used to escaping
+ protected $_escape_char = '"';
+
+ // clause and character used for LIKE escape sequences
+ protected $_like_escape_str = " ESCAPE '%s' ";
+ protected $_like_escape_chr = '!';
+
+ /**
+ * Load the result drivers
+ *
+ * @return string the name of the result class
+ */
+ protected function _load_rdriver()
+ {
+ $driver = 'CI_DB_native_'.$this->dbdriver.'_result';
+
+ if ( ! class_exists($driver))
+ {
+ require_once(BASEPATH.'database/DB_result.php');
+ require_once(BASEPATH.'database/drivers/native_result.php');
+ require_once(BASEPATH.'database/drivers/native/'.$this->dbdriver.'_result.php');
+ }
+
+ return $driver;
+ }
+
+}
+
+/* End of file native_driver.php */
+/* Location: ./system/database/drivers/native_driver.php */
View
7 ...database/drivers/pdo/subdrivers/pdo_4d_driver.php → system/database/drivers/pdo/4d_driver.php
@@ -40,7 +40,8 @@
*/
class CI_DB_pdo_4d_driver extends CI_DB_pdo_driver {
- public $subdriver = '4d';
+ public $dbdriver = '4d';
+ public $platform = '4d';
// The character used for escaping
protected $_escape_char = array('[', ']');
@@ -219,5 +220,5 @@ protected function _limit($sql, $limit, $offset)
}
-/* End of file pdo_4d_driver.php */
-/* Location: ./system/database/drivers/pdo/subdrivers/pdo_4d_driver.php */
+/* Location: ./system/database/drivers/pdo/4d_driver.php */
View
7 ...base/drivers/pdo/subdrivers/pdo_cubrid_driver.php → system/database/drivers/pdo/cubrid_driver.php
@@ -40,7 +40,8 @@
*/
class CI_DB_pdo_cubrid_driver extends CI_DB_pdo_driver {
- public $subdriver = 'cubrid';
+ public $dbdriver = 'cubrid';
+ public $platform = 'cubrid';
protected $_escape_char = '`';
@@ -185,5 +186,5 @@ protected function _truncate($table)
}
-/* End of file pdo_cubrid_driver.php */
-/* Location: ./system/database/drivers/pdo/subdrivers/pdo_cubrid_driver.php */
+/* Location: ./system/database/drivers/pdo/cubrid_driver.php */
View
11 ...abase/drivers/pdo/subdrivers/pdo_dblib_driver.php → system/database/drivers/pdo/dblib_driver.php
@@ -40,7 +40,8 @@
*/
class CI_DB_pdo_dblib_driver extends CI_DB_pdo_driver {
- public $subdriver = 'dblib';
+ public $dbdriver = 'dblib';
+ public $platform = 'mssql';
protected $_random_keyword = ' NEWID()';
@@ -60,7 +61,7 @@ public function __construct($params)
if (empty($this->dsn))
{
- $this->dsn = $params['subdriver'].':host='.(empty($this->hostname) ? '127.0.0.1' : $this->hostname);
+ $this->dsn = $this->platform.':host='.(empty($this->hostname) ? '127.0.0.1' : $this->hostname);
if ( ! empty($this->port))
{
@@ -77,8 +78,6 @@ public function __construct($params)
{
$this->dsn .= ';charset='.$this->char_set;
}
-
- $this->subdriver = 'dblib';
}
}
@@ -261,5 +260,5 @@ protected function _limit($sql, $limit, $offset)
}
-/* End of file pdo_dblib_driver.php */
-/* Location: ./system/database/drivers/pdo/subdrivers/pdo_dblib_driver.php */
+/* End of file dblib_driver.php */
+/* Location: ./system/database/drivers/pdo/dblib_driver.php */
View
7 ...se/drivers/pdo/subdrivers/pdo_firebird_driver.php → system/database/drivers/pdo/firebird_driver.php
@@ -40,7 +40,8 @@
*/
class CI_DB_pdo_firebird_driver extends CI_DB_pdo_driver {
- public $subdriver = 'firebird';
+ public $dbdriver = 'firebird';
+ public $platform = 'firebird';
/**
* The syntax to count rows is slightly different across different
@@ -258,5 +259,5 @@ protected function _limit($sql, $limit, $offset)
}
-/* End of file pdo_firebird_driver.php */
-/* Location: ./system/database/drivers/pdo/subdrivers/pdo_firebird_driver.php */
+/* Location: ./system/database/drivers/pdo/firebird_driver.php */
View
7 ...atabase/drivers/pdo/subdrivers/pdo_ibm_driver.php → system/database/drivers/pdo/ibm_driver.php
@@ -40,7 +40,8 @@
*/
class CI_DB_pdo_ibm_driver extends CI_DB_pdo_driver {
- public $subdriver = 'ibm';
+ public $dbdriver = 'ibm';
+ public $platform = 'db2';
protected $_random_keyword = ' RAND()';
@@ -258,5 +259,5 @@ protected function _limit($sql, $limit, $offset)
}
-/* End of file pdo_ibm_driver.php */
-/* Location: ./system/database/drivers/pdo/subdrivers/pdo_ibm_driver.php */
+/* Location: ./system/database/drivers/pdo/ibm_driver.php */
View
7 ...se/drivers/pdo/subdrivers/pdo_informix_driver.php → system/database/drivers/pdo/informix_driver.php
@@ -40,7 +40,8 @@
*/
class CI_DB_pdo_informix_driver extends CI_DB_pdo_driver {
- public $subdriver = 'informix';
+ public $dbdriver = 'informix';
+ public $platform = 'informix';
protected $_random_keyword = ' RAND()';
@@ -267,5 +268,5 @@ protected function _limit($sql, $limit, $offset)
}
-/* End of file pdo_informix_driver.php */
-/* Location: ./system/database/drivers/pdo/subdrivers/pdo_informix_driver.php */
+/* Location: ./system/database/drivers/pdo/informix_driver.php */
View
7 ...abase/drivers/pdo/subdrivers/pdo_mysql_driver.php → system/database/drivers/pdo/mysql_driver.php
@@ -40,7 +40,8 @@
*/
class CI_DB_pdo_mysql_driver extends CI_DB_pdo_driver {
- public $subdriver = 'mysql';
+ public $dbdriver = 'mysql';
+ public $platform = 'mysql';
protected $_escape_char = '`';
@@ -213,5 +214,5 @@ protected function _truncate($table)
}
-/* End of file pdo_mysql_driver.php */
-/* Location: ./system/database/drivers/pdo/subdrivers/pdo_mysql_driver.php */
+/* Location: ./system/database/drivers/pdo/mysql_driver.php */
View
7 ...atabase/drivers/pdo/subdrivers/pdo_oci_driver.php → system/database/drivers/pdo/oci_driver.php
@@ -40,7 +40,8 @@
*/
class CI_DB_pdo_oci_driver extends CI_DB_pdo_driver {
- public $subdriver = 'oci';
+ public $dbdriver = 'oci';
+ public $platform = 'oracle';
/**
* The syntax to count rows is slightly different across different
@@ -226,5 +227,5 @@ protected function _limit($sql, $limit, $offset)
}
-/* End of file pdo_oci_driver.php */
-/* Location: ./system/database/drivers/pdo/subdrivers/pdo_oci_driver.php */
+/* Location: ./system/database/drivers/pdo/oci_driver.php */
View
6 ...tabase/drivers/pdo/subdrivers/pdo_odbc_driver.php → system/database/drivers/pdo/odbc_driver.php
@@ -40,7 +40,7 @@
*/
class CI_DB_pdo_odbc_driver extends CI_DB_pdo_driver {
- public $subdriver = 'odbc';
+ public $dbdriver = 'odbc';
// The character used for escaping - not used in ODBC
protected $_escape_char = '';
@@ -264,5 +264,5 @@ protected function _limit($sql, $limit, $offset)
}
-/* End of file pdo_odbc_driver.php */
-/* Location: ./system/database/drivers/pdo/subdrivers/pdo_odbc_driver.php */
+/* Location: ./system/database/drivers/pdo/odbc_driver.php */
View
7 ...abase/drivers/pdo/subdrivers/pdo_pgsql_driver.php → system/database/drivers/pdo/pgsql_driver.php
@@ -40,7 +40,8 @@
*/
class CI_DB_pdo_pgsql_driver extends CI_DB_pdo_driver {
- public $subdriver = 'pgsql';
+ public $dbdriver = 'pgsql';
+ public $platform = 'postgre';
protected $_random_keyword = ' RANDOM()';
@@ -337,5 +338,5 @@ protected function _where($key, $value = NULL, $type = 'AND ', $escape = NULL)
}
-/* End of file pdo_pgsql_driver.php */
-/* Location: ./system/database/drivers/pdo/subdrivers/pdo_pgsql_driver.php */
+/* Location: ./system/database/drivers/pdo/pgsql_driver.php */
View
7 ...base/drivers/pdo/subdrivers/pdo_sqlite_driver.php → system/database/drivers/pdo/sqlite_driver.php
@@ -40,7 +40,8 @@
*/
class CI_DB_pdo_sqlite_driver extends CI_DB_pdo_driver {
- public $subdriver = 'sqlite';
+ public $dbdriver = 'sqlite';
+ public $platform = 'sqlite';
/**
* The syntax to count rows is slightly different across different
@@ -163,5 +164,5 @@ protected function _truncate($table)
}
-/* End of file pdo_sqlite_driver.php */
-/* Location: ./system/database/drivers/pdo/subdrivers/pdo_sqlite_driver.php */
+/* Location: ./system/database/drivers/pdo/sqlite_driver.php */
View
7 ...base/drivers/pdo/subdrivers/pdo_sqlsrv_driver.php → system/database/drivers/pdo/sqlsrv_driver.php
@@ -40,7 +40,8 @@
*/
class CI_DB_pdo_sqlsrv_driver extends CI_DB_pdo_driver {
- public $subdriver = 'sqlsrv';
+ public $dbdriver = 'sqlsrv';
+ public $platform = 'mssql';
protected $_random_keyword = ' NEWID()';
@@ -295,5 +296,5 @@ protected function _limit($sql, $limit, $offset)
}
-/* End of file pdo_sqlsrv_driver.php */
-/* Location: ./system/database/drivers/pdo/subdrivers/pdo_sqlsrv_driver.php */
+/* End of file sqlsrv_driver.php */
+/* Location: ./system/database/drivers/pdo/sqlsrv_driver.php */
View
37 system/database/drivers/pdo/pdo_driver.php → system/database/drivers/pdo_driver.php
@@ -26,21 +26,19 @@
*/
/**
- * PDO Database Adapter Class
+ * PDO Database Interface 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
+ * @subpackage Interfaces
* @category Database
* @author EllisLab Dev Team
* @link http://codeigniter.com/user_guide/database/
*/
-class CI_DB_pdo_driver extends CI_DB {
-
- public $dbdriver = 'pdo';
+abstract class CI_DB_pdo_driver extends CI_DB {
// The character used to escaping
protected $_escape_char = '"';
@@ -59,7 +57,7 @@ class CI_DB_pdo_driver extends CI_DB {
/**
* Constructor
*
- * Validates the DSN string and/or detects the subdriver
+ * Validates the DSN string
*
* @param array
* @return void
@@ -68,38 +66,19 @@ public function __construct($params)
{
parent::__construct($params);
- if (preg_match('/([^;]+):/', $this->dsn, $match) && count($match) === 2)
+ if (preg_match('/^[a-z0-9]+\:[^;\s]+/i', $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.
- $this->subdriver = $match[1];
return;
}
// Legacy support for DSN specified in the hostname field
- elseif (preg_match('/([^;]+):/', $this->hostname, $match) && count($match) === 2)
+ elseif (preg_match('/^[a-z0-9]+\:[^;\s]+/i', $this->hostname, $match) && count($match) === 2)
{
$this->dsn = $this->hostname;
$this->hostname = NULL;
- $this->subdriver = $match[1];
return;
}
- elseif (in_array($this->subdriver, array('mssql', 'sybase'), TRUE))
- {
- $this->subdriver = 'dblib';
- }
- elseif ($this->subdriver === '4D')
- {
- $this->subdriver = '4d';
- }
- elseif ( ! in_array($this->subdriver, array('4d', 'cubrid', 'dblib', 'firebird', 'ibm', 'informix', 'mysql', 'oci', 'odbc', 'sqlite', 'sqlsrv'), TRUE))
- {
- log_message('error', 'PDO: Invalid or non-existent subdriver');
-
- if ($this->db_debug)
- {
- show_error('Invalid or non-existent PDO subdriver');
- }
- }
$this->dsn = NULL;
}
@@ -158,7 +137,7 @@ public function version()
return $this->data_cache['version'];
}
- // Not all subdrivers support the getAttribute() method
+ // Not all PDO drivers support the getAttribute() method
try
{
return $this->data_cache['version'] = $this->conn_id->getAttribute(PDO::ATTR_SERVER_VERSION);
@@ -423,4 +402,4 @@ protected function _truncate($table)
}
/* End of file pdo_driver.php */
-/* Location: ./system/database/drivers/pdo/pdo_driver.php */
+/* Location: ./system/database/drivers/pdo_driver.php */
View
2  system/database/drivers/pdo/pdo_result.php → system/database/drivers/pdo_result.php
@@ -216,4 +216,4 @@ protected function _fetch_object($class_name = 'stdClass')
}
/* End of file pdo_result.php */
-/* Location: ./system/database/drivers/pdo/pdo_result.php */
View
2  system/database/drivers/cubrid/cubrid_forge.php → system/database/forge/cubrid_forge.php
@@ -214,4 +214,4 @@ protected function _alter_table($alter_type, $table, $fields, $after_field = '')
}
/* End of file cubrid_forge.php */
-/* Location: ./system/database/drivers/cubrid/cubrid_forge.php */
View
8 system/database/drivers/ibase/ibase_forge.php → system/database/forge/firebird_forge.php
@@ -26,13 +26,13 @@
*/
/**
- * Interbase/Firebird Forge Class
+ * Firebird Forge Class
*
* @category Database
* @author EllisLab Dev Team
* @link http://codeigniter.com/user_guide/database/
*/
-class CI_DB_ibase_forge extends CI_DB_forge {
+class CI_DB_firebird_forge extends CI_DB_forge {
protected $_drop_table = 'DROP TABLE %s';
@@ -190,5 +190,5 @@ protected function _alter_table($alter_type, $table, $column_name, $column_defin
}
-/* End of file ibase_forge.php */
-/* Location: ./system/database/drivers/ibase/ibase_forge.php */
+/* Location: ./system/database/forge/firebird_forge.php */
View
10 system/database/forge/index.html
@@ -0,0 +1,10 @@
+<html>
+<head>
+ <title>403 Forbidden</title>
+</head>
+<body>
+
+<p>Directory access is forbidden.</p>
+
+</body>
+</html>
View
8 system/database/drivers/sqlsrv/sqlsrv_forge.php → system/database/forge/mssql_forge.php
@@ -26,13 +26,13 @@
*/
/**
- * SQLSRV Forge Class
+ * MSSQL Forge Class
*
* @category Database
* @author EllisLab Dev Team
* @link http://codeigniter.com/user_guide/database/
*/
-class CI_DB_sqlsrv_forge extends CI_DB_forge {
+class CI_DB_mssql_forge extends CI_DB_forge {
protected $_drop_table = 'DROP TABLE %s';
@@ -156,5 +156,5 @@ protected function _alter_table($alter_type, $table, $column_name, $column_defin
}
-/* End of file sqlsrv_forge.php */
-/* Location: ./system/database/drivers/sqlsrv/sqlsrv_forge.php */
+/* Location: ./system/database/forge/mssql_forge.php */
View
2  system/database/drivers/mysql/mysql_forge.php → system/database/forge/mysql_forge.php
@@ -198,4 +198,4 @@ protected function _alter_table($alter_type, $table, $fields, $after_field = '')
}
/* End of file mysql_forge.php */
-/* Location: ./system/database/drivers/mysql/mysql_forge.php */
View
6 system/database/drivers/oci8/oci8_forge.php → system/database/forge/oracle_forge.php
@@ -32,7 +32,7 @@
* @author EllisLab Dev Team
* @link http://codeigniter.com/user_guide/database/
*/
-class CI_DB_oci8_forge extends CI_DB_forge {
+class CI_DB_oracle_forge extends CI_DB_forge {
protected $_create_database = FALSE;
protected $_drop_database = FALSE;
@@ -154,5 +154,5 @@ protected function _alter_table($alter_type, $table, $column_name, $column_defin
}
-/* End of file oci8_forge.php */
-/* Location: ./system/database/drivers/oci8/oci8_forge.php */
+/* Location: ./system/database/forge/oracle_forge.php */
View
2  system/database/drivers/postgre/postgre_forge.php → system/database/forge/postgre_forge.php
@@ -216,4 +216,4 @@ protected function _alter_table($alter_type, $table, $fields, $after_field = '')
}
/* End of file postgre_forge.php */
-/* Location: ./system/database/drivers/postgre/postgre_forge.php */
View
8 system/database/drivers/sqlite3/sqlite3_forge.php → system/database/forge/sqlite_forge.php
@@ -26,13 +26,13 @@
*/
/**
- * SQLite3 Forge Class
+ * SQLite Forge Class
*
* @category Database
* @author Andrey Andreev
* @link http://codeigniter.com/user_guide/database/
*/
-class CI_DB_sqlite3_forge extends CI_DB_forge {
+class CI_DB_sqlite_forge extends CI_DB_forge {
/**
* Create database
@@ -207,5 +207,5 @@ protected function _alter_table($alter_type, $table, $column_name, $column_defin
}
-/* End of file sqlite3_forge.php */
-/* Location: ./system/database/drivers/sqlite3/sqlite3_forge.php */
+/* Location: ./system/database/forge/sqlite_forge.php */
View
6 tests/mocks/database/config/mysql.php
@@ -9,7 +9,7 @@
'username' => 'travis',
'password' => '',
'database' => 'ci_test',
- 'dbdriver' => 'mysql'
+ 'dbdriver' => 'mysqli'
),
// Database configuration with failover
@@ -19,7 +19,7 @@
'username' => 'not_travis',
'password' => 'wrong password',
'database' => 'not_ci_test',
- 'dbdriver' => 'mysql',
+ 'dbdriver' => 'mysqli',
'failover' => array(
array(
'dsn' => '',
@@ -27,7 +27,7 @@
'username' => 'travis',
'password' => '',
'database' => 'ci_test',
- 'dbdriver' => 'mysql',
+ 'dbdriver' => 'mysqli',
)
)
)
View
9 tests/mocks/database/config/pdo/mysql.php
@@ -9,8 +9,7 @@
'username' => 'travis',
'password' => '',
'database' => 'ci_test',
- 'dbdriver' => 'pdo',
- 'subdriver' => 'mysql'
+ 'dbdriver' => 'mysql'
),
// Database configuration with failover
@@ -20,8 +19,7 @@
'username' => 'not_travis',
'password' => 'wrong password',
'database' => 'not_ci_test',
- 'dbdriver' => 'pdo',
- 'subdriver' => 'mysql',
+ 'dbdriver' => 'mysql',
'failover' => array(
array(
'dsn' => 'mysql:host=localhost;dbname=ci_test',
@@ -29,8 +27,7 @@
'username' => 'travis',
'password' => '',
'database' => 'ci_test',
- 'dbdriver' => 'pdo',
- 'subdriver' => 'mysql'
+ 'dbdriver' => 'mysql'
)
)
)
View
9 tests/mocks/database/config/pdo/pgsql.php
@@ -9,8 +9,7 @@
'username' => 'postgres',
'password' => '',
'database' => 'ci_test',
- 'dbdriver' => 'pdo',
- 'subdriver' => 'pgsql'
+ 'dbdriver' => 'pgsql'
),
// Database configuration with failover
@@ -20,8 +19,7 @@
'username' => 'not_travis',
'password' => 'wrong password',
'database' => 'not_ci_test',
- 'dbdriver' => 'pdo',
- 'subdriver' => 'pgsql',
+ 'dbdriver' => 'pgsql',
'failover' => array(
array(
'dsn' => 'pgsql:host=localhost;port=5432;dbname=ci_test;',
@@ -29,8 +27,7 @@
'username' => 'postgres',
'password' => '',
'database' => 'ci_test',
- 'dbdriver' => 'pdo',
- 'subdriver' => 'pgsql'
+ 'dbdriver' => 'pgsql'
)
)
)
View
9 tests/mocks/database/config/pdo/sqlite.php
@@ -9,8 +9,7 @@
'username' => 'sqlite',
'password' => 'sqlite',
'database' => 'sqlite',
- 'dbdriver' => 'pdo',
- 'subdriver' => 'sqlite'
+ 'dbdriver' => 'sqlite'
),
// Database configuration with failover
@@ -20,8 +19,7 @@
'username' => 'sqlite',
'password' => 'sqlite',
'database' => 'sqlite',
- 'dbdriver' => 'pdo',
- 'subdriver' => 'sqlite',
+ 'dbdriver' => 'sqlite',
'failover' => array(
array(
'dsn' => 'sqlite:/'.realpath(__DIR__.'/../..').'/ci_test.sqlite',
@@ -29,8 +27,7 @@
'username' => 'sqlite',
'password' => 'sqlite',
'database' => 'sqlite',
- 'dbdriver' => 'pdo',
- 'subdriver' => 'sqlite'
+ 'dbdriver' => 'sqlite'
)
)
)
View
2  tests/mocks/database/db.php
@@ -46,7 +46,6 @@ public function set_dsn($group = 'default')
$config = array_merge($this->config[$group], $params);
$dsnstring = empty($config['dsn']) ? FALSE : $config['dsn'];
- $subdriver = empty($config['subdriver']) ? FALSE: $config['subdriver'];
$failover = empty($config['failover']) ? FALSE : $config['failover'];
$dsn = $config['dbdriver'].'://'.$config['username'].':'.$config['password']
@@ -55,7 +54,6 @@ public function set_dsn($group = 'default')
// Build the parameter
$other_params = array_slice($config, 6);
if ($dsnstring) $other_params['dsn'] = $dsnstring;
- if ($subdriver) $other_params['subdriver'] = $subdriver;
if ($failover) $other_params['failover'] = $failover;
return $dsn.'?'.http_build_query($other_params);
Please sign in to comment.
Something went wrong with that request. Please try again.