summaryrefslogtreecommitdiffstats
path: root/system/database/drivers/mysqli
diff options
context:
space:
mode:
Diffstat (limited to 'system/database/drivers/mysqli')
-rw-r--r--system/database/drivers/mysqli/mysqli_forge.php17
1 files changed, 14 insertions, 3 deletions
diff --git a/system/database/drivers/mysqli/mysqli_forge.php b/system/database/drivers/mysqli/mysqli_forge.php
index f767acbea..da79bc6ac 100644
--- a/system/database/drivers/mysqli/mysqli_forge.php
+++ b/system/database/drivers/mysqli/mysqli_forge.php
@@ -153,16 +153,27 @@ class CI_DB_mysqli_forge extends CI_DB_forge {
if (count($primary_keys) > 0)
{
+ $key_name = $this->db->_protect_identifiers(implode('_', $primary_keys));
$primary_keys = $this->db->_protect_identifiers($primary_keys);
- $sql .= ",\n\tPRIMARY KEY (" . implode(', ', $primary_keys) . ")";
+ $sql .= ",\n\tPRIMARY KEY ".$key_name." (" . implode(', ', $primary_keys) . ")";
}
if (is_array($keys) && count($keys) > 0)
{
- $keys = $this->db->_protect_identifiers($keys);
foreach ($keys as $key)
{
- $sql .= ",\n\tKEY ($key)";
+ if (is_array($key))
+ {
+ $key_name = $this->db->_protect_identifiers(implode('_', $key));
+ $key = $this->db->_protect_identifiers($key);
+ }
+ else
+ {
+ $key_name = $this->db->_protect_identifiers($key);
+ $key = array($key_name);
+ }
+
+ $sql .= ",\n\tKEY {$key_name} (" . implode(', ', $key) . ")";
}
}