summaryrefslogtreecommitdiffstats
path: root/system/database/drivers/pdo/subdrivers
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/pdo/subdrivers
parentde1fe7d504898bc6a42e24b4c73da3887a9933d6 (diff)
parentecc260e0be0cdb55c4e4802b78ddd78b0d8b0ebc (diff)
Merge branch 'develop' into feature/user-guide-cleanup
Diffstat (limited to 'system/database/drivers/pdo/subdrivers')
-rw-r--r--system/database/drivers/pdo/subdrivers/pdo_mysql_forge.php30
1 files changed, 24 insertions, 6 deletions
diff --git a/system/database/drivers/pdo/subdrivers/pdo_mysql_forge.php b/system/database/drivers/pdo/subdrivers/pdo_mysql_forge.php
index 74689d91e..3ac98e6c3 100644
--- a/system/database/drivers/pdo/subdrivers/pdo_mysql_forge.php
+++ b/system/database/drivers/pdo/subdrivers/pdo_mysql_forge.php
@@ -96,16 +96,34 @@ class CI_DB_pdo_mysql_forge extends CI_DB_pdo_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;
}
// --------------------------------------------------------------------