summaryrefslogtreecommitdiffstats
path: root/system/database/drivers/oci8/oci8_forge.php
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-06-08 00:12:54 +0200
committerAndrey Andreev <narf@bofh.bg>2012-06-08 00:12:54 +0200
commit5ef194df98294d5427c0e7582ca88b1fc06e1d72 (patch)
treea416426f8b46b2d78b9a2f3d64e22e7c05d6e937 /system/database/drivers/oci8/oci8_forge.php
parent36529cae874aa380cafd10dd2552fbe0545d7915 (diff)
Resolve formatting differences between DB forge drivers
Diffstat (limited to 'system/database/drivers/oci8/oci8_forge.php')
-rw-r--r--system/database/drivers/oci8/oci8_forge.php38
1 files changed, 22 insertions, 16 deletions
diff --git a/system/database/drivers/oci8/oci8_forge.php b/system/database/drivers/oci8/oci8_forge.php
index 837e7eaad..4fd3dc4a5 100644
--- a/system/database/drivers/oci8/oci8_forge.php
+++ b/system/database/drivers/oci8/oci8_forge.php
@@ -73,11 +73,22 @@ class CI_DB_oci8_forge extends CI_DB_forge {
{
$attributes = array_change_key_case($attributes, CASE_UPPER);
- $sql .= "\n\t".$this->db->protect_identifiers($field).' '.$attributes['TYPE']
- .((isset($attributes['UNSINGED']) && $attributes['UNSIGNED'] === TRUE) ? ' UNSIGNED' : '')
- .(isset($attributes['DEFAULT']) ? " DEFAULT '".$attributes['DEFAULT']."'" : '')
- .((isset($attributes['NULL']) && $attributes['NULL'] === TRUE) ? '' : ' NOT NULL')
- .(isset($attributes['CONSTRAINT']) ? ' CONSTRAINT '.$attributes['CONSTRAINT'] : '');
+ $sql .= "\n\t".$this->db->escape_identifiers($field).' '.$attributes['TYPE'];
+
+ if (isset($attributes['UNSINGED']) && $attributes['UNSIGNED'] === TRUE)
+ {
+ $sql .= ' UNSIGNED';
+ }
+
+ if (isset($attributes['DEFAULT']))
+ {
+ $sql .= " DEFAULT '".$attributes['DEFAULT']."'";
+ }
+
+ $sql .= (isset($attributes['NULL']) && $attributes['NULL'] === TRUE)
+ ? '' : ' NOT NULL';
+
+ empty($attributes['CONSTRAINT']) OR ' CONSTRAINT '.$attributes['CONSTRAINT'];
}
// don't add a comma on the end of the last field
@@ -89,7 +100,7 @@ class CI_DB_oci8_forge extends CI_DB_forge {
if (count($primary_keys) > 0)
{
- $primary_keys = $this->db->protect_identifiers($primary_keys);
+ $primary_keys = $this->db->escape_identifiers($primary_keys);
$sql .= ",\n\tCONSTRAINT ".$table.' PRIMARY KEY ('.implode(', ', $primary_keys).')';
}
@@ -97,14 +108,9 @@ class CI_DB_oci8_forge extends CI_DB_forge {
{
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 COLUMNS (".implode(', ', $key).')';
}
@@ -132,7 +138,7 @@ class CI_DB_oci8_forge extends CI_DB_forge {
*/
protected function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '')
{
- $sql = 'ALTER TABLE '.$this->db->protect_identifiers($table).' '.$alter_type.' '.$this->db->protect_identifiers($column_name);
+ $sql = 'ALTER TABLE '.$this->db->escape_identifiers($table).' '.$alter_type.' '.$this->db->escape_identifiers($column_name);
// DROP has everything it needs now.
if ($alter_type === 'DROP')
@@ -143,7 +149,7 @@ class CI_DB_oci8_forge extends CI_DB_forge {
return $sql.' '.$column_definition
.($default_value !== '' ? ' DEFAULT "'.$default_value.'"' : '')
.($null === NULL ? ' NULL' : ' NOT NULL')
- .($after_field !== '' ? ' AFTER '.$this->db->protect_identifiers($after_field) : '');
+ .($after_field !== '' ? ' AFTER '.$this->db->escape_identifiers($after_field) : '');
}