diff options
author | Zachary Flower <zach@ninjaninja.net> | 2014-11-03 05:50:15 +0100 |
---|---|---|
committer | Zachary Flower <zach@ninjaninja.net> | 2014-11-03 05:50:15 +0100 |
commit | 24fbc61e4a46c1e9f185c36629960dce0bad71e2 (patch) | |
tree | 8c84c06fe04ceec7b5f28c21edc578c24c694bb1 /system/database/DB_forge.php | |
parent | 72b4be8310dc5b05169501bd9851fedf559003a5 (diff) |
Add support for the COMMENT field in DBForge and MySQL Forge classes (pdo, mysql, and mysqli)
Signed-off-by: Zachary Flower <zach@ninjaninja.net>
Diffstat (limited to 'system/database/DB_forge.php')
-rw-r--r-- | system/database/DB_forge.php | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/system/database/DB_forge.php b/system/database/DB_forge.php index aa8bbbe3f..df3b90be6 100644 --- a/system/database/DB_forge.php +++ b/system/database/DB_forge.php @@ -156,6 +156,13 @@ abstract class CI_DB_forge { */ protected $_default = ' DEFAULT '; + /** + * COMMENT value representation in CREATE/ALTER TABLE statements + * + * @var string + */ + protected $_comment = ' COMMENT '; + // -------------------------------------------------------------------- /** @@ -849,6 +856,7 @@ abstract class CI_DB_forge { .$field['default'] .$field['null'] .$field['auto_increment'] + .$field['comment'] .$field['unique']; } @@ -987,6 +995,28 @@ abstract class CI_DB_forge { // -------------------------------------------------------------------- /** + * 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 |