summaryrefslogtreecommitdiffstats
path: root/system/database/drivers/pdo/pdo_driver.php
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-04-06 19:50:07 +0200
committerAndrey Andreev <narf@bofh.bg>2012-04-06 19:50:07 +0200
commitea09a8a5552f2aacdeab0c88a605fe44047ebd0a (patch)
treeecb4f682b436653f82bd23cc6fb479531b07c6ba /system/database/drivers/pdo/pdo_driver.php
parente9f2095056a579bad9bf2ad80116cc8454f6520e (diff)
Renamed _escape_identifiers() to escape_identifiers() and moved it to CI_DB_driver
Diffstat (limited to 'system/database/drivers/pdo/pdo_driver.php')
-rw-r--r--system/database/drivers/pdo/pdo_driver.php49
1 files changed, 6 insertions, 43 deletions
diff --git a/system/database/drivers/pdo/pdo_driver.php b/system/database/drivers/pdo/pdo_driver.php
index bd9eddee3..919bb9c00 100644
--- a/system/database/drivers/pdo/pdo_driver.php
+++ b/system/database/drivers/pdo/pdo_driver.php
@@ -487,7 +487,7 @@ class CI_DB_pdo_driver extends CI_DB {
}
else
{
- $sql = 'SHOW TABLES FROM '.$this->_escape_identifiers($this->database);
+ $sql = 'SHOW TABLES FROM '.$this->escape_identifiers($this->database);
}
if ($prefix_limit !== FALSE AND $this->dbprefix != '')
@@ -510,7 +510,7 @@ class CI_DB_pdo_driver extends CI_DB {
*/
protected function _list_columns($table = '')
{
- return 'SHOW COLUMNS FROM '.$this->_escape_identifiers($table);
+ return 'SHOW COLUMNS FROM '.$this->escape_identifiers($table);
}
// --------------------------------------------------------------------
@@ -528,20 +528,20 @@ class CI_DB_pdo_driver extends CI_DB {
if ($this->pdodriver == 'mysql' or $this->pdodriver == 'pgsql')
{
// Analog function for mysql and postgre
- return 'SELECT * FROM '.$this->_escape_identifiers($table).' LIMIT 1';
+ return 'SELECT * FROM '.$this->escape_identifiers($table).' LIMIT 1';
}
elseif ($this->pdodriver == 'oci')
{
// Analog function for oci
- return 'SELECT * FROM '.$this->_escape_identifiers($table).' WHERE ROWNUM <= 1';
+ return 'SELECT * FROM '.$this->escape_identifiers($table).' WHERE ROWNUM <= 1';
}
elseif ($this->pdodriver == 'sqlite')
{
// Analog function for sqlite
- return 'PRAGMA table_info('.$this->_escape_identifiers($table).')';
+ return 'PRAGMA table_info('.$this->escape_identifiers($table).')';
}
- return 'SELECT TOP 1 FROM '.$this->_escape_identifiers($table);
+ return 'SELECT TOP 1 FROM '.$this->escape_identifiers($table);
}
// --------------------------------------------------------------------
@@ -576,43 +576,6 @@ class CI_DB_pdo_driver extends CI_DB {
// --------------------------------------------------------------------
/**
- * Escape the SQL Identifiers
- *
- * This function escapes column and table names
- *
- * @param string
- * @return string
- */
- public function _escape_identifiers($item)
- {
- if ($this->_escape_char == '')
- {
- return $item;
- }
-
- foreach ($this->_reserved_identifiers as $id)
- {
- if (strpos($item, '.'.$id) !== FALSE)
- {
- $item = str_replace('.', $this->_escape_char.'.', $item);
-
- // remove duplicates if the user already included the escape
- return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $this->_escape_char.$item);
- }
- }
-
- if (strpos($item, '.') !== FALSE)
- {
- $item = str_replace('.', $this->_escape_char.'.'.$this->_escape_char, $item);
- }
-
- // remove duplicates if the user already included the escape
- return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $this->_escape_char.$item.$this->_escape_char);
- }
-
- // --------------------------------------------------------------------
-
- /**
* From Tables
*
* This function implicitly groups FROM tables so there is no confusion