diff options
author | Andrey Andreev <narf@bofh.bg> | 2012-06-06 13:12:15 +0200 |
---|---|---|
committer | Andrey Andreev <narf@bofh.bg> | 2012-06-06 13:12:15 +0200 |
commit | 968690491f625ddf59a5136b55ae1b9a2cf98a9a (patch) | |
tree | 6bc3eff6e8ec3ecae925ac3ff5c9542888f160f4 /system/database/drivers/sqlite/sqlite_forge.php | |
parent | 58dc75471c25f33b059967ffb515eedc08e86a0b (diff) | |
parent | 6683c3c872952ae16d98c89ef474e5522897592a (diff) |
Merge upstream branch and some changes for better readability
Diffstat (limited to 'system/database/drivers/sqlite/sqlite_forge.php')
-rw-r--r-- | system/database/drivers/sqlite/sqlite_forge.php | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/system/database/drivers/sqlite/sqlite_forge.php b/system/database/drivers/sqlite/sqlite_forge.php index 0a1c156be..f6dd49043 100644 --- a/system/database/drivers/sqlite/sqlite_forge.php +++ b/system/database/drivers/sqlite/sqlite_forge.php @@ -103,18 +103,28 @@ class CI_DB_sqlite_forge extends CI_DB_forge { { $attributes = array_change_key_case($attributes, CASE_UPPER); - $sql .= "\n\t".$this->db->protect_identifiers($field) - .' '.$attributes['TYPE'] + $sql .= "\n\t".$this->db->protect_identifiers($field).' '.$attributes['TYPE']; - .( ! empty($attributes['CONSTRAINT']) ? '('.$attributes['CONSTRAINT'].')' : '') + empty($attributes['CONSTRAINT']) OR $sql .= '('.$attributes['CONSTRAINT'].')'; - .(( ! empty($attributes['UNSIGNED']) && $attributes['UNSIGNED'] === TRUE) ? ' UNSIGNED' : '') + if ( ! empty($attributes['UNSIGNED']) && $attributes['UNSIGNED'] === TRUE) + { + $sql .= ' UNSIGNED'; + } - .(isset($attributes['DEFAULT']) ? ' DEFAULT \''.$attributes['DEFAULT'].'\'' : '') + if (isset($attributes['DEFAULT'])) + { + $sql .= " DEFAULT'".$attributes['DEFAULT']."'"; + } - .(( ! empty($attributes['NULL']) && $attributes['NULL'] === TRUE) ? ' NULL' : ' NOT NULL') - .(( ! empty($attributes['AUTO_INCREMENT']) && $attributes['AUTO_INCREMENT'] === TRUE) ? ' AUTO_INCREMENT' : ''); + $sql .= ( ! empty($attributes['NULL']) && $attributes['NULL'] === TRUE) + ? ' NULL' : ' NOT NULL'; + + if ( ! empty($attributes['AUTO_INCREMENT']) && $attributes['AUTO_INCREMENT'] === TRUE) + { + $sql .= ' AUTO_INCREMENT'; + } } // don't add a comma on the end of the last field |