summaryrefslogtreecommitdiffstats
path: root/system/database/drivers/mysql/mysql_utility.php
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-02-14 13:45:02 +0100
committerAndrey Andreev <narf@bofh.bg>2012-02-14 13:45:02 +0100
commit93cac5cc7bd1537788506d577c69852b4895a932 (patch)
treeb272a77537277112c532624db79318969935fa7b /system/database/drivers/mysql/mysql_utility.php
parente35d6943d513b4f016b763eebe8b97a9f1c902e3 (diff)
Fix issue #1039
Diffstat (limited to 'system/database/drivers/mysql/mysql_utility.php')
-rw-r--r--system/database/drivers/mysql/mysql_utility.php15
1 files changed, 8 insertions, 7 deletions
diff --git a/system/database/drivers/mysql/mysql_utility.php b/system/database/drivers/mysql/mysql_utility.php
index 0e7c18e16..538aaa0f7 100644
--- a/system/database/drivers/mysql/mysql_utility.php
+++ b/system/database/drivers/mysql/mysql_utility.php
@@ -56,7 +56,7 @@ class CI_DB_mysql_utility extends CI_DB_utility {
*/
public function _optimize_table($table)
{
- return 'OPTIMIZE TABLE '.$this->db->_escape_identifiers($table);
+ return 'OPTIMIZE TABLE '.$this->db->protect_identifiers($table);
}
// --------------------------------------------------------------------
@@ -71,7 +71,7 @@ class CI_DB_mysql_utility extends CI_DB_utility {
*/
public function _repair_table($table)
{
- return 'REPAIR TABLE '.$this->db->_escape_identifiers($table);
+ return 'REPAIR TABLE '.$this->db->protect_identifiers($table);
}
// --------------------------------------------------------------------
@@ -102,7 +102,7 @@ class CI_DB_mysql_utility extends CI_DB_utility {
}
// Get the table schema
- $query = $this->db->query('SHOW CREATE TABLE `'.$this->db->database.'`.`'.$table.'`');
+ $query = $this->db->query('SHOW CREATE TABLE '.$this->db->protect_identifiers($this->db->database).'.'.$this->db->protect_identifiers($table));
// No result means the table name was invalid
if ($query === FALSE)
@@ -115,7 +115,7 @@ class CI_DB_mysql_utility extends CI_DB_utility {
if ($add_drop == TRUE)
{
- $output .= 'DROP TABLE IF EXISTS '.$table.';'.$newline.$newline;
+ $output .= 'DROP TABLE IF EXISTS '.($this->db->protect_identifiers($table).';'.$newline.$newline;
}
$i = 0;
@@ -135,7 +135,7 @@ class CI_DB_mysql_utility extends CI_DB_utility {
}
// Grab all the data from the current table
- $query = $this->db->query('SELECT * FROM '.$table);
+ $query = $this->db->query('SELECT * FROM '.$this->db->protect_identifiers($table));
if ($query->num_rows() == 0)
{
@@ -157,7 +157,7 @@ class CI_DB_mysql_utility extends CI_DB_utility {
TRUE);
// Create a string of field names
- $field_str .= '`'.$field->name.'`, ';
+ $field_str .= $this->db->protect_identifiers($field->name).', ';
$i++;
}
@@ -192,7 +192,7 @@ class CI_DB_mysql_utility extends CI_DB_utility {
$val_str = preg_replace('/, $/' , '', $val_str);
// Build the INSERT string
- $output .= 'INSERT INTO '.$table.' ('.$field_str.') VALUES ('.$val_str.');'.$newline;
+ $output .= 'INSERT INTO '.$this->db->protect_identifiers($table).' ('.$field_str.') VALUES ('.$val_str.');'.$newline;
}
return $output.$newline.$newline;
@@ -200,6 +200,7 @@ class CI_DB_mysql_utility extends CI_DB_utility {
return $output;
}
+
}
/* End of file mysql_utility.php */