diff options
author | Andrey Andreev <narf@bofh.bg> | 2012-11-12 11:51:14 +0100 |
---|---|---|
committer | Andrey Andreev <narf@bofh.bg> | 2012-11-12 11:51:14 +0100 |
commit | b67277b8063b0e6aab051ce269194255ef83e808 (patch) | |
tree | f0ce631b9ee3134de2cf009e4d5f02401f31aaac /system/database/drivers/cubrid | |
parent | b0a97c100f5e7edc5e21ec7d07f768cd3b5618da (diff) |
Bring back the AFTER clause for DB Forge add_column()
(it was temporarily removed due to multiple inconsistencies with other drivers)
This commit also fixes issue #1988.
Also added support for the FIRST clause (again, MySQL and CUBRID only).
Diffstat (limited to 'system/database/drivers/cubrid')
-rw-r--r-- | system/database/drivers/cubrid/cubrid_forge.php | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/system/database/drivers/cubrid/cubrid_forge.php b/system/database/drivers/cubrid/cubrid_forge.php index 86a41e57b..05762ba5a 100644 --- a/system/database/drivers/cubrid/cubrid_forge.php +++ b/system/database/drivers/cubrid/cubrid_forge.php @@ -123,6 +123,35 @@ class CI_DB_cubrid_forge extends CI_DB_forge { // -------------------------------------------------------------------- /** + * Process column + * + * @param array $field + * @return string + */ + protected function _process_column($field) + { + $extra_clause = isset($field['after']) + ? ' AFTER '.$this->db->escape_identifiers($field['after']) : ''; + + if (empty($extra_clause) && isset($field['first']) && $field['first'] === TRUE) + { + $extra_clause = ' FIRST'; + } + + return $this->db->escape_identifiers($field['name']) + .(empty($field['new_name']) ? '' : $this->db->escape_identifiers($field['new_name'])) + .' '.$field['type'].$field['length'] + .$field['unsigned'] + .$field['null'] + .$field['default'] + .$field['auto_increment'] + .$field['unique'] + .$extra_clause; + } + + // -------------------------------------------------------------------- + + /** * Field attribute TYPE * * Performs a data type mapping between different databases. |