escape_identifiers() to accept arrays as well
diff --git a/system/database/drivers/cubrid/cubrid_forge.php b/system/database/drivers/cubrid/cubrid_forge.php
index 8434cd2..d328aa2 100644
--- a/system/database/drivers/cubrid/cubrid_forge.php
+++ b/system/database/drivers/cubrid/cubrid_forge.php
@@ -158,7 +158,7 @@
if (count($primary_keys) > 0)
{
$key_name = $this->db->escape_identifiers('pk_'.$table.'_'.implode('_', $primary_keys));
- $sql .= ",\n\tCONSTRAINT ".$key_name.' PRIMARY KEY('.implode(', ', $this->db->protect_identifiers($primary_keys)).')';
+ $sql .= ",\n\tCONSTRAINT ".$key_name.' PRIMARY KEY('.implode(', ', $this->db->escape_identifiers($primary_keys)).')';
}
if (is_array($keys) && count($keys) > 0)
@@ -168,7 +168,7 @@
if (is_array($key))
{
$key_name = $this->db->escape_identifiers('idx_'.$table.implode('_', $key));
- $key = $this->db->protect_identifiers($key);
+ $key = $this->db->escape_identifiers($key);
}
else
{
diff --git a/system/database/drivers/interbase/interbase_forge.php b/system/database/drivers/interbase/interbase_forge.php
index 4e6a60c..3f9967f 100644
--- a/system/database/drivers/interbase/interbase_forge.php
+++ b/system/database/drivers/interbase/interbase_forge.php
@@ -87,7 +87,7 @@
{
$sql = 'CREATE TABLE ';
- $sql .= $this->db->protect_identifiers($table).'(';
+ $sql .= $this->db->escape_identifiers($table).'(';
$current_field_count = 0;
foreach ($fields as $field => $attributes)
@@ -135,7 +135,7 @@
if (count($primary_keys) > 0)
{
- $primary_keys = $this->db->protect_identifiers($primary_keys);
+ $primary_keys = $this->db->escape_identifiers($primary_keys);
$sql .= ",\n\tPRIMARY KEY (".implode(', ', $primary_keys).')';
}
@@ -144,7 +144,7 @@
foreach ($keys as $key)
{
$key = is_array($key)
- ? $this->db->protect_identifiers($key)
+ ? $this->db->escape_identifiers($key)
: array($this->db->escape_identifiers($key));
$sql .= ",\n\tUNIQUE (".implode(', ', $key).')';
diff --git a/system/database/drivers/mssql/mssql_forge.php b/system/database/drivers/mssql/mssql_forge.php
index 4d98221..3a3528f 100644
--- a/system/database/drivers/mssql/mssql_forge.php
+++ b/system/database/drivers/mssql/mssql_forge.php
@@ -103,7 +103,7 @@
if (count($primary_keys) > 0)
{
- $sql .= ",\n\tPRIMARY KEY (".implode(', ', $this->db->protect_identifiers($primary_keys)).')';
+ $sql .= ",\n\tPRIMARY KEY (".implode(', ', $this->db->escape_identifiers($primary_keys)).')';
}
if (is_array($keys) && count($keys) > 0)
@@ -111,7 +111,7 @@
foreach ($keys as $key)
{
$key = is_array($key)
- ? $this->db->protect_identifiers($key)
+ ? $this->db->escape_identifiers($key)
: array($this->db->escape_identifiers($key));
$sql .= ",\n\tFOREIGN KEY (".implode(', ', $key).')';
diff --git a/system/database/drivers/mysql/mysql_forge.php b/system/database/drivers/mysql/mysql_forge.php
index 7656c28..d22454d 100644
--- a/system/database/drivers/mysql/mysql_forge.php
+++ b/system/database/drivers/mysql/mysql_forge.php
@@ -142,7 +142,7 @@
if (count($primary_keys) > 0)
{
$key_name = $this->db->escape_identifiers(implode('_', $primary_keys));
- $sql .= ",\n\tPRIMARY KEY ".$key_name.' ('.implode(', ', $this->db->protect_identifiers($primary_keys)).')';
+ $sql .= ",\n\tPRIMARY KEY ".$key_name.' ('.implode(', ', $this->db->escape_identifiers($primary_keys)).')';
}
if (is_array($keys) && count($keys) > 0)
@@ -152,7 +152,7 @@
if (is_array($key))
{
$key_name = $this->db->escape_identifiers(implode('_', $key));
- $key = $this->db->protect_identifiers($key);
+ $key = $this->db->escape_identifiers($key);
}
else
{
diff --git a/system/database/drivers/mysql/mysql_utility.php b/system/database/drivers/mysql/mysql_utility.php
index 643682f..f0bbc66 100644
--- a/system/database/drivers/mysql/mysql_utility.php
+++ b/system/database/drivers/mysql/mysql_utility.php
@@ -65,7 +65,7 @@
}
// Get the table schema
- $query = $this->db->query('SHOW CREATE TABLE '.$this->db->protect_identifiers($this->db->database).'.'.$this->db->protect_identifiers($table));
+ $query = $this->db->query('SHOW CREATE TABLE '.$this->db->escape_identifiers($this->db->database.'.'.$table));
// No result means the table name was invalid
if ($query === FALSE)
@@ -120,7 +120,7 @@
TRUE);
// Create a string of field names
- $field_str .= $this->db->protect_identifiers($field->name).', ';
+ $field_str .= $this->db->escape_identifiers($field->name).', ';
$i++;
}
diff --git a/system/database/drivers/mysqli/mysqli_forge.php b/system/database/drivers/mysqli/mysqli_forge.php
index e0e98f1..b74c775 100644
--- a/system/database/drivers/mysqli/mysqli_forge.php
+++ b/system/database/drivers/mysqli/mysqli_forge.php
@@ -152,7 +152,7 @@
if (is_array($key))
{
$key_name = $this->db->escape_identifiers(implode('_', $key));
- $key = $this->db->protect_identifiers($key);
+ $key = $this->db->escape_identifiers($key);
}
else
{
diff --git a/system/database/drivers/oci8/oci8_forge.php b/system/database/drivers/oci8/oci8_forge.php
index be09375..92e8c02 100644
--- a/system/database/drivers/oci8/oci8_forge.php
+++ b/system/database/drivers/oci8/oci8_forge.php
@@ -100,7 +100,7 @@
if (count($primary_keys) > 0)
{
- $sql .= ",\n\tCONSTRAINT ".$table.' PRIMARY KEY ('.implode(', ', $this->db->protect_identifiers($primary_keys)).')';
+ $sql .= ",\n\tCONSTRAINT ".$table.' PRIMARY KEY ('.implode(', ', $this->db->escape_identifiers($primary_keys)).')';
}
if (is_array($keys) && count($keys) > 0)
@@ -108,7 +108,7 @@
foreach ($keys as $key)
{
$key = is_array($key)
- ? $this->db->protect_identifiers($key)
+ ? $this->db->escape_identifiers($key)
: array($this->db->escape_identifiers($key));
$sql .= ",\n\tUNIQUE COLUMNS (".implode(', ', $key).')';
diff --git a/system/database/drivers/odbc/odbc_forge.php b/system/database/drivers/odbc/odbc_forge.php
index 5c0b200..b074c58 100644
--- a/system/database/drivers/odbc/odbc_forge.php
+++ b/system/database/drivers/odbc/odbc_forge.php
@@ -104,7 +104,7 @@
if (count($primary_keys) > 0)
{
- $sql .= ",\n\tPRIMARY KEY (".implode(', ', $this->protect_identifiers($primary_keys)).')';
+ $sql .= ",\n\tPRIMARY KEY (".implode(', ', $this->escape_identifiers($primary_keys)).')';
}
if (is_array($keys) && count($keys) > 0)
@@ -112,7 +112,7 @@
foreach ($keys as $key)
{
$key = is_array($key)
- ? $this->db->protect_identifiers($key)
+ ? $this->db->escape_identifiers($key)
: array($this->db->escape_identifiers($key));
$sql .= ",\n\tFOREIGN KEY (".implode(', ', $key).')';
diff --git a/system/database/drivers/pdo/pdo_forge.php b/system/database/drivers/pdo/pdo_forge.php
index 5645750..02ceb74 100644
--- a/system/database/drivers/pdo/pdo_forge.php
+++ b/system/database/drivers/pdo/pdo_forge.php
@@ -112,7 +112,7 @@
if (count($primary_keys) > 0)
{
- $sql .= ",\n\tPRIMARY KEY (".implode(', ', $this->db->protect_identifiers($primary_keys)).')';
+ $sql .= ",\n\tPRIMARY KEY (".implode(', ', $this->db->escape_identifiers($primary_keys)).')';
}
if (is_array($keys) && count($keys) > 0)
@@ -120,7 +120,7 @@
foreach ($keys as $key)
{
$key = is_array($key)
- ? $this->db->protect_identifiers($key)
+ ? $this->db->escape_identifiers($key)
: array($this->db->escape_identifiers($key));
$sql .= ",\n\tFOREIGN KEY (".implode(', ', $key).')';
diff --git a/system/database/drivers/postgre/postgre_forge.php b/system/database/drivers/postgre/postgre_forge.php
index fc11245..c434e95 100644
--- a/system/database/drivers/postgre/postgre_forge.php
+++ b/system/database/drivers/postgre/postgre_forge.php
@@ -158,13 +158,7 @@
if (count($primary_keys) > 0)
{
- // Something seems to break when passing an array to escape_identifiers()
- foreach ($primary_keys as $index => $key)
- {
- $primary_keys[$index] = $this->db->escape_identifiers($key);
- }
-
- $sql .= ",\n\tPRIMARY KEY (".implode(', ', $primary_keys).')';
+ $sql .= ",\n\tPRIMARY KEY (".implode(', ', $this->db->escape_identifiers($primary_keys)).')';
}
$sql .= "\n);";
@@ -174,7 +168,7 @@
foreach ($keys as $key)
{
$key = is_array($key)
- ? $this->db->protect_identifiers($key)
+ ? $this->db->escape_identifiers($key)
: array($this->db->escape_identifiers($key));
foreach ($key as $field)
diff --git a/system/database/drivers/sqlite/sqlite_forge.php b/system/database/drivers/sqlite/sqlite_forge.php
index ba7dc90..71eed7d 100644
--- a/system/database/drivers/sqlite/sqlite_forge.php
+++ b/system/database/drivers/sqlite/sqlite_forge.php
@@ -136,7 +136,7 @@
if (count($primary_keys) > 0)
{
- $sql .= ",\n\tPRIMARY KEY (".implode(', ', $this->db->protect_identifiers($primary_keys)).')';
+ $sql .= ",\n\tPRIMARY KEY (".implode(', ', $this->db->escape_identifiers($primary_keys)).')';
}
if (is_array($keys) && count($keys) > 0)
@@ -144,7 +144,7 @@
foreach ($keys as $key)
{
$key = is_array($key)
- ? $this->db->protect_identifiers($key)
+ ? $this->db->escape_identifiers($key)
: array($this->db->escape_identifiers($key));
$sql .= ",\n\tUNIQUE (".implode(', ', $key).')';
diff --git a/system/database/drivers/sqlite3/sqlite3_forge.php b/system/database/drivers/sqlite3/sqlite3_forge.php
index 84651ab..f8bd116 100644
--- a/system/database/drivers/sqlite3/sqlite3_forge.php
+++ b/system/database/drivers/sqlite3/sqlite3_forge.php
@@ -143,7 +143,7 @@
if (count($primary_keys) > 0)
{
- $sql .= ",\n\tPRIMARY KEY (".implode(', ', $this->db->protect_identifiers($primary_keys)).')';
+ $sql .= ",\n\tPRIMARY KEY (".implode(', ', $this->db->escape_identifiers($primary_keys)).')';
}
if (is_array($keys) && count($keys) > 0)
@@ -151,7 +151,7 @@
foreach ($keys as $key)
{
$key = is_array($key)
- ? $this->db->protect_identifiers($key)
+ ? $this->db->escape_identifiers($key)
: array($this->db->escape_identifiers($key));
$sql .= ",\n\tUNIQUE (".implode(', ', $key).')';
diff --git a/system/database/drivers/sqlsrv/sqlsrv_forge.php b/system/database/drivers/sqlsrv/sqlsrv_forge.php
index 559746e..e6f7e1a 100644
--- a/system/database/drivers/sqlsrv/sqlsrv_forge.php
+++ b/system/database/drivers/sqlsrv/sqlsrv_forge.php
@@ -103,7 +103,7 @@
if (count($primary_keys) > 0)
{
- $sql .= ",\n\tPRIMARY KEY (".implode(', ', $this->db->protect_identifiers($primary_keys)).')';
+ $sql .= ",\n\tPRIMARY KEY (".implode(', ', $this->db->escape_identifiers($primary_keys)).')';
}
if (is_array($keys) && count($keys) > 0)
@@ -111,7 +111,7 @@
foreach ($keys as $key)
{
$key = is_array($key)
- ? $this->db->protect_identifiers($key)
+ ? $this->db->escape_identifiers($key)
: array($this->escape_identifiers($key));
$sql .= ",\n\tFOREIGN KEY (".implode(', ', $key).')';