summaryrefslogtreecommitdiffstats
path: root/system/database/drivers/mysql/mysql_forge.php
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2014-01-24 13:28:47 +0100
committerAndrey Andreev <narf@devilix.net>2014-01-24 13:28:47 +0100
commit98d6cc84718f471b150bb4e1ec93a7c89a967f69 (patch)
treebf7bc5507eb0ea6f9372d7d15c88069d32798f40 /system/database/drivers/mysql/mysql_forge.php
parentde1fe7d504898bc6a42e24b4c73da3887a9933d6 (diff)
parentecc260e0be0cdb55c4e4802b78ddd78b0d8b0ebc (diff)
Merge branch 'develop' into feature/user-guide-cleanup
Diffstat (limited to 'system/database/drivers/mysql/mysql_forge.php')
-rw-r--r--system/database/drivers/mysql/mysql_forge.php30
1 files changed, 24 insertions, 6 deletions
diff --git a/system/database/drivers/mysql/mysql_forge.php b/system/database/drivers/mysql/mysql_forge.php
index e251c0ea6..3b3cbdee0 100644
--- a/system/database/drivers/mysql/mysql_forge.php
+++ b/system/database/drivers/mysql/mysql_forge.php
@@ -82,16 +82,34 @@ class CI_DB_mysql_forge extends CI_DB_forge {
// --------------------------------------------------------------------
/**
- * Class constructor
+ * CREATE TABLE attributes
*
- * @param object &$db Database object
- * @return void
+ * @param array $attributes Associative array of table attributes
+ * @return string
*/
- public function __construct(&$db)
+ protected function _create_table_attr($attributes)
{
- parent::__construct($db);
+ $sql = '';
+
+ foreach (array_keys($attributes) as $key)
+ {
+ if (is_string($key))
+ {
+ $sql .= ' '.strtoupper($key).' = '.$attributes[$key];
+ }
+ }
- $this->_create_table .= ' DEFAULT CHARSET '.$this->db->char_set.' COLLATE '.$this->db->dbcollat;
+ if ( ! empty($this->db->char_set) && ! strpos($sql, 'CHARACTER SET') && ! strpos($sql, 'CHARSET'))
+ {
+ $sql .= ' DEFAULT CHARACTER SET = '.$this->db->char_set;
+ }
+
+ if ( ! empty($this->db->dbcollat) && ! strpos($sql, 'COLLATE'))
+ {
+ $sql .= ' COLLATE = '.$this->db->dbcollat;
+ }
+
+ return $sql;
}
// --------------------------------------------------------------------