Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MySQL driver was changed in accordance with suggestions

Waiting for new version of MySQLi driver to change it also.
  • Loading branch information...
commit c3fe704fefc6b2c51091cbf21892c8da380f317e 1 parent 3bc4774
@MunGell MunGell authored
View
26 system/database/DB_forge.php
@@ -209,14 +209,7 @@ public function create_table($table = '', $if_not_exists = FALSE)
}
else
{
- if (method_exists($this, '_set_table_engine'))
- {
- $sql = $this->_create_table($this->db->dbprefix.$table, $this->fields, $this->primary_keys, $this->keys, $if_not_exists, $this->engine);
- }
- else
- {
- show_error('Your database does not support different engines.');
- }
+ $sql = $this->_create_table($this->db->dbprefix.$table, $this->fields, $this->primary_keys, $this->keys, $if_not_exists, $this->engine);
}
$this->_reset();
return is_bool($sql) ? $sql : $this->db->query($sql);
@@ -266,21 +259,12 @@ public function rename_table($table_name, $new_table_name)
*/
public function set_table_engine($table_name, $engine)
{
- if (method_exists($this, '_set_table_engine'))
+ if ($table_name == '' OR $engine == '')
{
- if ($table_name == '' OR $engine == '')
- {
- show_error('A table name is required for that operation.');
- }
-
- return $this->db->query($this->_set_table_engine($this->db->dbprefix.$table_name, $engine));
- }
- else
- {
- log_message('debug', 'Table change engine function does not exist.');
-
- return FALSE;
+ show_error('A table name is required for that operation.');
}
+
+ return $this->db->query($this->_alter_table('ENGINE', $this->db->dbprefix.$table_name, $engine));
}
// --------------------------------------------------------------------
View
25 system/database/drivers/mysql/mysql_forge.php
@@ -139,7 +139,7 @@ private function _process_fields($fields)
* @param string the table engine
* @return bool
*/
- public function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists)
+ public function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists, $engine = NULL)
{
$sql = 'CREATE TABLE ';
@@ -221,6 +221,11 @@ public function _alter_table($alter_type, $table, $fields, $after_field = '')
{
return $sql.$this->db->protect_identifiers($fields);
}
+
+ if ($alter_type === 'ENGINE')
+ {
+ return $sql.$fields;
+ }
return $sql.$this->_process_fields($fields)
.($after_field != '' ? ' AFTER '.$this->db->protect_identifiers($after_field) : '');
@@ -241,24 +246,6 @@ public function _rename_table($table_name, $new_table_name)
{
return 'ALTER TABLE '.$this->db->protect_identifiers($table_name).' RENAME TO '.$this->db->protect_identifiers($new_table_name);
}
-
- // --------------------------------------------------------------------
-
- /**
- * Set engine of a table
- *
- * Generates a platform-specific query so engine of that a table can be changed
- *
- * @access private
- * @param string the table name
- * @param string the table engine
- * @return string
- */
- function _set_table_engine($table_name, $engine)
- {
- $sql = 'ALTER TABLE '.$this->db->_protect_identifiers($table_name).' ENGINE '.$engine;
- return $sql;
- }
}
Please sign in to comment.
Something went wrong with that request. Please try again.