summaryrefslogtreecommitdiffstats
path: root/system/database
diff options
context:
space:
mode:
Diffstat (limited to 'system/database')
-rw-r--r--system/database/DB_forge.php5
-rw-r--r--system/database/drivers/mysql/mysql_forge.php3
-rw-r--r--system/database/drivers/mysqli/mysqli_forge.php3
-rw-r--r--system/database/drivers/pdo/subdrivers/pdo_mysql_forge.php3
4 files changed, 14 insertions, 0 deletions
diff --git a/system/database/DB_forge.php b/system/database/DB_forge.php
index aa8bbbe3f..85505ce41 100644
--- a/system/database/DB_forge.php
+++ b/system/database/DB_forge.php
@@ -808,6 +808,11 @@ abstract class CI_DB_forge {
$this->_attr_auto_increment($attributes, $field);
$this->_attr_unique($attributes, $field);
+ if (isset($attributes['COMMENT']))
+ {
+ $field['comment'] = $this->db->escape($attributes['COMMENT']);
+ }
+
if (isset($attributes['TYPE']) && ! empty($attributes['CONSTRAINT']))
{
switch (strtoupper($attributes['TYPE']))
diff --git a/system/database/drivers/mysql/mysql_forge.php b/system/database/drivers/mysql/mysql_forge.php
index 6f0d6c5e2..282e2d1d8 100644
--- a/system/database/drivers/mysql/mysql_forge.php
+++ b/system/database/drivers/mysql/mysql_forge.php
@@ -185,6 +185,8 @@ 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']))
.' '.$field['type'].$field['length']
@@ -193,6 +195,7 @@ class CI_DB_mysql_forge extends CI_DB_forge {
.$field['default']
.$field['auto_increment']
.$field['unique']
+ .$comment_clause
.$extra_clause;
}
diff --git a/system/database/drivers/mysqli/mysqli_forge.php b/system/database/drivers/mysqli/mysqli_forge.php
index c9a5b6db7..38f624909 100644
--- a/system/database/drivers/mysqli/mysqli_forge.php
+++ b/system/database/drivers/mysqli/mysqli_forge.php
@@ -187,6 +187,8 @@ 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']
@@ -195,6 +197,7 @@ class CI_DB_mysqli_forge extends CI_DB_forge {
.$field['default']
.$field['auto_increment']
.$field['unique']
+ .$comment_clause
.$extra_clause;
}
diff --git a/system/database/drivers/pdo/subdrivers/pdo_mysql_forge.php b/system/database/drivers/pdo/subdrivers/pdo_mysql_forge.php
index 6cdfcabb5..2e988c3f5 100644
--- a/system/database/drivers/pdo/subdrivers/pdo_mysql_forge.php
+++ b/system/database/drivers/pdo/subdrivers/pdo_mysql_forge.php
@@ -199,6 +199,8 @@ class CI_DB_pdo_mysql_forge extends CI_DB_pdo_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']
@@ -207,6 +209,7 @@ class CI_DB_pdo_mysql_forge extends CI_DB_pdo_forge {
.$field['default']
.$field['auto_increment']
.$field['unique']
+ .$comment_clause
.$extra_clause;
}