summaryrefslogtreecommitdiffstats
path: root/system/database/drivers/odbc/odbc_forge.php
diff options
context:
space:
mode:
authorDerek Jones <derek.jones@ellislab.com>2008-05-29 19:52:11 +0200
committerDerek Jones <derek.jones@ellislab.com>2008-05-29 19:52:11 +0200
commitbd4400988922b2560975a80498404d7ecd000c0b (patch)
tree2c8630cd43f1a16700c53363578191de342fb3d4 /system/database/drivers/odbc/odbc_forge.php
parent9e11220c2b780ca3320deae7e91a272b84c88533 (diff)
made MySQL/MySQLi forge use explicitly named KEYs, added ability to specify multi-column non-primary keys in table creation
Diffstat (limited to 'system/database/drivers/odbc/odbc_forge.php')
-rw-r--r--system/database/drivers/odbc/odbc_forge.php16
1 files changed, 12 insertions, 4 deletions
diff --git a/system/database/drivers/odbc/odbc_forge.php b/system/database/drivers/odbc/odbc_forge.php
index 60df616c3..10924abe2 100644
--- a/system/database/drivers/odbc/odbc_forge.php
+++ b/system/database/drivers/odbc/odbc_forge.php
@@ -146,16 +146,24 @@ class CI_DB_odbc_forge extends CI_DB_forge {
$primary_keys = $this->db->_protect_identifiers($primary_keys);
$sql .= ",\n\tPRIMARY KEY (" . implode(', ', $primary_keys) . ")";
}
-
+
if (is_array($keys) && count($keys) > 0)
{
- $keys = $this->db->_protect_identifiers($keys);
foreach ($keys as $key)
{
- $sql .= ",\n\tFOREIGN KEY ($key)";
+ if (is_array($key))
+ {
+ $key = $this->db->_protect_identifiers($key);
+ }
+ else
+ {
+ $key = array($this->db->_protect_identifiers($key));
+ }
+
+ $sql .= ",\n\tFOREIGN KEY (" . implode(', ', $key) . ")";
}
}
-
+
$sql .= "\n)";
return $sql;