diff options
author | Phil Sturgeon <email@philsturgeon.co.uk> | 2011-02-16 20:03:49 +0100 |
---|---|---|
committer | Phil Sturgeon <email@philsturgeon.co.uk> | 2011-02-16 20:03:49 +0100 |
commit | 33ed0f37b6b8f2223cd3362bf8fca28102ab67c6 (patch) | |
tree | 99c613720a2fd8541764bb6fc893e0da28fa269b /system/database/drivers/mysql | |
parent | 154da11c5bb4b7dc5c225f4fa018852ee45cc6eb (diff) | |
parent | d8d1e24eee56d2466c91ecd72b3c8932eb3d0639 (diff) |
Merged CodeIgniter Core changes and integrated rob1's secure cookie change into my secure cookie change.
Diffstat (limited to 'system/database/drivers/mysql')
-rw-r--r-- | system/database/drivers/mysql/mysql_driver.php | 20 | ||||
-rw-r--r-- | system/database/drivers/mysql/mysql_forge.php | 23 |
2 files changed, 29 insertions, 14 deletions
diff --git a/system/database/drivers/mysql/mysql_driver.php b/system/database/drivers/mysql/mysql_driver.php index df18c912e..4ff9b0a11 100644 --- a/system/database/drivers/mysql/mysql_driver.php +++ b/system/database/drivers/mysql/mysql_driver.php @@ -286,13 +286,13 @@ class CI_DB_mysql_driver extends CI_DB { { if (is_array($str)) { - foreach($str as $key => $val) - { + foreach ($str as $key => $val) + { $str[$key] = $this->escape_str($val, $like); - } + } - return $str; - } + return $str; + } if (function_exists('mysql_real_escape_string') AND is_resource($this->conn_id)) { @@ -590,9 +590,9 @@ class CI_DB_mysql_driver extends CI_DB { */ function _update($table, $values, $where, $orderby = array(), $limit = FALSE) { - foreach($values as $key => $val) + foreach ($values as $key => $val) { - $valstr[] = $key." = ".$val; + $valstr[] = $key . ' = ' . $val; } $limit = ( ! $limit) ? '' : ' LIMIT '.$limit; @@ -627,11 +627,11 @@ class CI_DB_mysql_driver extends CI_DB { $ids = array(); $where = ($where != '' AND count($where) >=1) ? implode(" ", $where).' AND ' : ''; - foreach($values as $key => $val) + foreach ($values as $key => $val) { $ids[] = $val[$index]; - foreach(array_keys($val) as $field) + foreach (array_keys($val) as $field) { if ($field != $index) { @@ -643,7 +643,7 @@ class CI_DB_mysql_driver extends CI_DB { $sql = "UPDATE ".$table." SET "; $cases = ''; - foreach($final as $k => $v) + foreach ($final as $k => $v) { $cases .= $k.' = CASE '."\n"; foreach ($v as $row) diff --git a/system/database/drivers/mysql/mysql_forge.php b/system/database/drivers/mysql/mysql_forge.php index c02b8cb3a..529ec980d 100644 --- a/system/database/drivers/mysql/mysql_forge.php +++ b/system/database/drivers/mysql/mysql_forge.php @@ -87,11 +87,26 @@ class CI_DB_mysql_forge extends CI_DB_forge { if (array_key_exists('TYPE', $attributes)) { $sql .= ' '.$attributes['TYPE']; - } - if (array_key_exists('CONSTRAINT', $attributes)) - { - $sql .= '('.$attributes['CONSTRAINT'].')'; + if (array_key_exists('CONSTRAINT', $attributes)) + { + switch ($attributes['TYPE']) + { + case 'decimal': + case 'float': + case 'numeric': + $sql .= '('.implode(',', $attributes['CONSTRAINT']).')'; + break; + + case 'enum': + case 'set': + $sql .= '("'.implode('","', $attributes['CONSTRAINT']).'")'; + break; + + default: + $sql .= '('.$attributes['CONSTRAINT'].')'; + } + } } if (array_key_exists('UNSIGNED', $attributes) && $attributes['UNSIGNED'] === TRUE) |