summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--system/database/drivers/mysql/mysql_forge.php5
-rw-r--r--system/database/drivers/mysqli/mysqli_forge.php6
-rw-r--r--system/database/drivers/oci8/oci8_forge.php8
-rw-r--r--system/database/drivers/pdo/subdrivers/pdo_mysql_forge.php4
-rw-r--r--system/database/drivers/pdo/subdrivers/pdo_oci_forge.php8
-rw-r--r--system/database/drivers/pdo/subdrivers/pdo_pgsql_forge.php13
-rw-r--r--system/database/drivers/postgre/postgre_forge.php13
-rw-r--r--user_guide_src/source/changelog.rst1
8 files changed, 43 insertions, 15 deletions
diff --git a/system/database/drivers/mysql/mysql_forge.php b/system/database/drivers/mysql/mysql_forge.php
index 282e2d1d8..1088c0321 100644
--- a/system/database/drivers/mysql/mysql_forge.php
+++ b/system/database/drivers/mysql/mysql_forge.php
@@ -88,7 +88,7 @@ class CI_DB_mysql_forge extends CI_DB_forge {
*
* @var string
*/
- protected $_null = 'NULL';
+ protected $_null = 'NULL';
// --------------------------------------------------------------------
@@ -185,7 +185,6 @@ class CI_DB_mysql_forge extends CI_DB_forge {
$extra_clause = ' FIRST';
}
- $comment_clause = isset($field['comment']) ? ' COMMENT ' . $field['comment'] : '';
return $this->db->escape_identifiers($field['name'])
.(empty($field['new_name']) ? '' : ' '.$this->db->escape_identifiers($field['new_name']))
@@ -195,7 +194,7 @@ class CI_DB_mysql_forge extends CI_DB_forge {
.$field['default']
.$field['auto_increment']
.$field['unique']
- .$comment_clause
+ .(empty($field['comment']) ? '' : ' COMMENT '.$field['comment'])
.$extra_clause;
}
diff --git a/system/database/drivers/mysqli/mysqli_forge.php b/system/database/drivers/mysqli/mysqli_forge.php
index 38f624909..24dc2b2ad 100644
--- a/system/database/drivers/mysqli/mysqli_forge.php
+++ b/system/database/drivers/mysqli/mysqli_forge.php
@@ -90,7 +90,7 @@ class CI_DB_mysqli_forge extends CI_DB_forge {
*
* @var string
*/
- protected $_null = 'NULL';
+ protected $_null = 'NULL';
// --------------------------------------------------------------------
@@ -187,8 +187,6 @@ class CI_DB_mysqli_forge extends CI_DB_forge {
$extra_clause = ' FIRST';
}
- $comment_clause = isset($field['comment']) ? ' COMMENT ' . $field['comment'] : '';
-
return $this->db->escape_identifiers($field['name'])
.(empty($field['new_name']) ? '' : ' '.$this->db->escape_identifiers($field['new_name']))
.' '.$field['type'].$field['length']
@@ -197,7 +195,7 @@ class CI_DB_mysqli_forge extends CI_DB_forge {
.$field['default']
.$field['auto_increment']
.$field['unique']
- .$comment_clause
+ .(empty($field['comment']) ? '' : ' COMMENT '.$field['comment'])
.$extra_clause;
}
diff --git a/system/database/drivers/oci8/oci8_forge.php b/system/database/drivers/oci8/oci8_forge.php
index 433692ddb..3576a9c43 100644
--- a/system/database/drivers/oci8/oci8_forge.php
+++ b/system/database/drivers/oci8/oci8_forge.php
@@ -106,6 +106,14 @@ class CI_DB_oci8_forge extends CI_DB_forge {
else
{
$field[$i]['_literal'] = "\n\t".$this->_process_column($field[$i]);
+
+ if ( ! empty($field[$i]['comment']))
+ {
+ $sqls[] = 'COMMENT ON COLUMN '
+ .$this->db->escape_identifiers($table).'.'.$this->db->escape_identifiers($field[$i]['name'])
+ .' IS '.$field[$i]['comment'];
+ }
+
if ($alter_type === 'MODIFY' && ! empty($field[$i]['new_name']))
{
$sqls[] = $sql.' RENAME COLUMN '.$this->db->escape_identifiers($field[$i]['name'])
diff --git a/system/database/drivers/pdo/subdrivers/pdo_mysql_forge.php b/system/database/drivers/pdo/subdrivers/pdo_mysql_forge.php
index 2e988c3f5..81b2a7e19 100644
--- a/system/database/drivers/pdo/subdrivers/pdo_mysql_forge.php
+++ b/system/database/drivers/pdo/subdrivers/pdo_mysql_forge.php
@@ -102,7 +102,7 @@ class CI_DB_pdo_mysql_forge extends CI_DB_pdo_forge {
*
* @var string
*/
- protected $_null = 'NULL';
+ protected $_null = 'NULL';
// --------------------------------------------------------------------
@@ -209,7 +209,7 @@ class CI_DB_pdo_mysql_forge extends CI_DB_pdo_forge {
.$field['default']
.$field['auto_increment']
.$field['unique']
- .$comment_clause
+ .(empty($field['comment']) ? '' : ' COMMENT '.$field['comment'])
.$extra_clause;
}
diff --git a/system/database/drivers/pdo/subdrivers/pdo_oci_forge.php b/system/database/drivers/pdo/subdrivers/pdo_oci_forge.php
index d4f33e144..ecbc887a0 100644
--- a/system/database/drivers/pdo/subdrivers/pdo_oci_forge.php
+++ b/system/database/drivers/pdo/subdrivers/pdo_oci_forge.php
@@ -106,6 +106,14 @@ class CI_DB_pdo_oci_forge extends CI_DB_pdo_forge {
else
{
$field[$i]['_literal'] = "\n\t".$this->_process_column($field[$i]);
+
+ if ( ! empty($field[$i]['comment']))
+ {
+ $sqls[] = 'COMMENT ON COLUMN '
+ .$this->db->escape_identifiers($table).'.'.$this->db->escape_identifiers($field[$i]['name'])
+ .' IS '.$field[$i]['comment'];
+ }
+
if ($alter_type === 'MODIFY' && ! empty($field[$i]['new_name']))
{
$sqls[] = $sql.' RENAME COLUMN '.$this->db->escape_identifiers($field[$i]['name'])
diff --git a/system/database/drivers/pdo/subdrivers/pdo_pgsql_forge.php b/system/database/drivers/pdo/subdrivers/pdo_pgsql_forge.php
index 00579aab4..66fcc761a 100644
--- a/system/database/drivers/pdo/subdrivers/pdo_pgsql_forge.php
+++ b/system/database/drivers/pdo/subdrivers/pdo_pgsql_forge.php
@@ -75,7 +75,7 @@ class CI_DB_pdo_pgsql_forge extends CI_DB_pdo_forge {
*
* @var string
*/
- protected $_null = 'NULL';
+ protected $_null = 'NULL';
// --------------------------------------------------------------------
@@ -144,6 +144,13 @@ class CI_DB_pdo_pgsql_forge extends CI_DB_pdo_forge {
$sqls[] = $sql.' RENAME COLUMN '.$this->db->escape_identifiers($field[$i]['name'])
.' TO '.$this->db->escape_identifiers($field[$i]['new_name']);
}
+
+ if ( ! empty($field[$i]['comment']))
+ {
+ $sqls[] = 'COMMENT ON COLUMN '
+ .$this->db->escape_identifiers($table).'.'.$this->db->escape_identifiers($field[$i]['name'])
+ .' IS '.$field[$i]['comment'];
+ }
}
return $sqls;
@@ -195,8 +202,8 @@ class CI_DB_pdo_pgsql_forge extends CI_DB_pdo_forge {
if ( ! empty($attributes['AUTO_INCREMENT']) && $attributes['AUTO_INCREMENT'] === TRUE)
{
$field['type'] = ($field['type'] === 'NUMERIC')
- ? 'BIGSERIAL'
- : 'SERIAL';
+ ? 'BIGSERIAL'
+ : 'SERIAL';
}
}
diff --git a/system/database/drivers/postgre/postgre_forge.php b/system/database/drivers/postgre/postgre_forge.php
index 1dcd02761..874c205ba 100644
--- a/system/database/drivers/postgre/postgre_forge.php
+++ b/system/database/drivers/postgre/postgre_forge.php
@@ -70,7 +70,7 @@ class CI_DB_postgre_forge extends CI_DB_forge {
*
* @var string
*/
- protected $_null = 'NULL';
+ protected $_null = 'NULL';
// --------------------------------------------------------------------
@@ -139,6 +139,13 @@ class CI_DB_postgre_forge extends CI_DB_forge {
$sqls[] = $sql.' RENAME COLUMN '.$this->db->escape_identifiers($field[$i]['name'])
.' TO '.$this->db->escape_identifiers($field[$i]['new_name']);
}
+
+ if ( ! empty($field[$i]['comment']))
+ {
+ $sqls[] = 'COMMENT ON COLUMN '
+ .$this->db->escape_identifiers($table).'.'.$this->db->escape_identifiers($field[$i]['name'])
+ .' IS '.$field[$i]['comment'];
+ }
}
return $sqls;
@@ -190,8 +197,8 @@ class CI_DB_postgre_forge extends CI_DB_forge {
if ( ! empty($attributes['AUTO_INCREMENT']) && $attributes['AUTO_INCREMENT'] === TRUE)
{
$field['type'] = ($field['type'] === 'NUMERIC')
- ? 'BIGSERIAL'
- : 'SERIAL';
+ ? 'BIGSERIAL'
+ : 'SERIAL';
}
}
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index 9d567482e..1c3a4322c 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -254,6 +254,7 @@ Release Date: Not Released
- Added support for passing a custom database object to the loader.
- Added support for passing custom table attributes (such as ``ENGINE`` for MySQL) to ``create_table()``.
- Added support for usage of the *FIRST* clause in ``add_column()`` for MySQL and CUBRID.
+ - Added partial support for field columns (MySQL, PostgreSQL, Oracle).
- Deprecated ``add_column()``'s third method. *AFTER* clause should now be added to the field definition array instead.
- Overall improved support for all of the drivers.