summaryrefslogtreecommitdiffstats
path: root/system/database/drivers/sqlite/sqlite_forge.php
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-06-07 20:34:56 +0200
committerAndrey Andreev <narf@bofh.bg>2012-06-07 20:34:56 +0200
commit9411557ac9d95c6b1b3e76fea533e0988cec1bec (patch)
tree5824b264466451d2f30104430391d0c1b767e489 /system/database/drivers/sqlite/sqlite_forge.php
parent3427797a2899506adbe5317671fe0b3c27c2a6a6 (diff)
Some more minor improvements
Diffstat (limited to 'system/database/drivers/sqlite/sqlite_forge.php')
-rw-r--r--system/database/drivers/sqlite/sqlite_forge.php19
1 files changed, 7 insertions, 12 deletions
diff --git a/system/database/drivers/sqlite/sqlite_forge.php b/system/database/drivers/sqlite/sqlite_forge.php
index f6dd49043..f8cfdf3ba 100644
--- a/system/database/drivers/sqlite/sqlite_forge.php
+++ b/system/database/drivers/sqlite/sqlite_forge.php
@@ -103,7 +103,7 @@ 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->escape_identifiers($field).' '.$attributes['TYPE'];
empty($attributes['CONSTRAINT']) OR $sql .= '('.$attributes['CONSTRAINT'].')';
@@ -114,7 +114,7 @@ class CI_DB_sqlite_forge extends CI_DB_forge {
if (isset($attributes['DEFAULT']))
{
- $sql .= " DEFAULT'".$attributes['DEFAULT']."'";
+ $sql .= " DEFAULT '".$attributes['DEFAULT']."'";
}
@@ -136,21 +136,16 @@ class CI_DB_sqlite_forge extends CI_DB_forge {
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)
{
foreach ($keys as $key)
{
- if (is_array($key))
- {
- $key = $this->db->protect_identifiers($key);
- }
- else
- {
- $key = array($this->db->protect_identifiers($key));
- }
+ $key = is_array($key)
+ ? $this->db->escape_identifiers($key)
+ : array($this->db->escape_identifiers($key);
$sql .= ",\n\tUNIQUE (".implode(', ', $key).')';
}
@@ -190,7 +185,7 @@ class CI_DB_sqlite_forge extends CI_DB_forge {
return 'ALTER TABLE '.$this->db->protect_identifiers($table).' '.$alter_type.' '.$this->db->protect_identifiers($column_name)
.' '.$column_definition
- .($default_value != '' ? ' DEFAULT "'.$default_value.'"' : '')
+ .($default_value != '' ? " DEFAULT '".$default_value."'" : '')
// If NOT NULL is specified, the field must have a DEFAULT value other than NULL
.(($null !== NULL && $default_value !== 'NULL') ? ' NOT NULL' : ' NULL');
}