summaryrefslogtreecommitdiffstats
path: root/system/database/drivers/oci8/oci8_forge.php
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-04-06 20:26:09 +0200
committerAndrey Andreev <narf@bofh.bg>2012-04-06 20:26:09 +0200
commitd65c3b5d057f4bc48e25cf3f968ceec844ebd155 (patch)
tree5636e0e5479f0ec71b4e3ef0b38496cc5acd0d0f /system/database/drivers/oci8/oci8_forge.php
parent2a23e4ad2b71f26262964ac49819ef0a7aebbb9a (diff)
parentea09a8a5552f2aacdeab0c88a605fe44047ebd0a (diff)
Merge upstream branch
Diffstat (limited to 'system/database/drivers/oci8/oci8_forge.php')
-rw-r--r--system/database/drivers/oci8/oci8_forge.php40
1 files changed, 12 insertions, 28 deletions
diff --git a/system/database/drivers/oci8/oci8_forge.php b/system/database/drivers/oci8/oci8_forge.php
index 8285a29d2..033e618e7 100644
--- a/system/database/drivers/oci8/oci8_forge.php
+++ b/system/database/drivers/oci8/oci8_forge.php
@@ -42,6 +42,7 @@ class CI_DB_oci8_forge extends CI_DB_forge {
*/
public function _create_database($name)
{
+ // Not supported - schemas in Oracle are actual usernames
return FALSE;
}
@@ -55,6 +56,7 @@ class CI_DB_oci8_forge extends CI_DB_forge {
*/
public function _drop_database($name)
{
+ // Not supported - schemas in Oracle are actual usernames
return FALSE;
}
@@ -68,7 +70,7 @@ class CI_DB_oci8_forge extends CI_DB_forge {
* @param mixed primary key(s)
* @param mixed key(s)
* @param bool should 'IF NOT EXISTS' be added to the SQL
- * @return bool
+ * @return string
*/
public function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists)
{
@@ -79,7 +81,7 @@ class CI_DB_oci8_forge extends CI_DB_forge {
$sql .= 'IF NOT EXISTS ';
}
- $sql .= $this->db->_escape_identifiers($table).' (';
+ $sql .= $this->db->escape_identifiers($table).' (';
$current_field_count = 0;
foreach ($fields as $field => $attributes)
@@ -128,7 +130,7 @@ class CI_DB_oci8_forge extends CI_DB_forge {
$key = array($this->db->protect_identifiers($key));
}
- $sql .= ",\n\tUNIQUE COLUMNS (".implode(', ', $key).")";
+ $sql .= ",\n\tUNIQUE COLUMNS (".implode(', ', $key).')';
}
}
@@ -140,11 +142,11 @@ class CI_DB_oci8_forge extends CI_DB_forge {
/**
* Drop Table
*
- * @return bool
+ * @return string
*/
public function _drop_table($table)
{
- return FALSE;
+ return 'DROP TABLE '.$this->db->protect_identifiers($table);
}
// --------------------------------------------------------------------
@@ -169,33 +171,15 @@ class CI_DB_oci8_forge extends CI_DB_forge {
$sql = 'ALTER TABLE '.$this->db->protect_identifiers($table).' '.$alter_type.' '.$this->db->protect_identifiers($column_name);
// DROP has everything it needs now.
- if ($alter_type == 'DROP')
+ if ($alter_type === 'DROP')
{
return $sql;
}
- $sql .= " $column_definition";
-
- if ($default_value != '')
- {
- $sql .= " DEFAULT \"$default_value\"";
- }
-
- if ($null === NULL)
- {
- $sql .= ' NULL';
- }
- else
- {
- $sql .= ' NOT NULL';
- }
-
- if ($after_field != '')
- {
- return $sql.' AFTER '.$this->db->protect_identifiers($after_field);
- }
-
- return $sql;
+ return $sql.' '.$column_definition
+ .($default_value != '' ? ' DEFAULT "'.$default_value.'"' : '')
+ .($null === NULL ? ' NULL' : ' NOT NULL')
+ .($after_field != '' ? ' AFTER '.$this->db->protect_identifiers($after_field) : '');
}