Add support for the COMMENT field in DBForge and MySQL Forge classes (pdo, mysql, and mysqli)
Signed-off-by: Zachary Flower <zach@ninjaninja.net>
diff --git a/system/database/DB_forge.php b/system/database/DB_forge.php
index aa8bbbe..df3b90b 100644
--- a/system/database/DB_forge.php
+++ b/system/database/DB_forge.php
@@ -156,6 +156,13 @@
*/
protected $_default = ' DEFAULT ';
+ /**
+ * COMMENT value representation in CREATE/ALTER TABLE statements
+ *
+ * @var string
+ */
+ protected $_comment = ' COMMENT ';
+
// --------------------------------------------------------------------
/**
@@ -849,6 +856,7 @@
.$field['default']
.$field['null']
.$field['auto_increment']
+ .$field['comment']
.$field['unique'];
}
@@ -987,6 +995,28 @@
// --------------------------------------------------------------------
/**
+ * Field attribute COMMENT
+ *
+ * @param array &$attributes
+ * @param array &$field
+ * @return void
+ */
+ protected function _attr_comment(&$attributes, &$field)
+ {
+ if ($this->_comment === FALSE)
+ {
+ return;
+ }
+
+ if (!empty($attributes['COMMENT']))
+ {
+ $field['comment'] = $this->_default.$this->db->escape($attributes['COMMENT']);
+ }
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
* Process primary keys
*
* @param string $table Table name