public function create_table($table, $if_not_exists = FALSE, array $attributes = array())
{
if ($table === '') {
show_error('A table name is required for that operation.');
} else {
$table = $this->db->dbprefix . $table;
}
if (count($this->fields) === 0) {
show_error('Field information is required.');
}
$sql = $this->_create_table($table, $if_not_exists, $attributes);
if (is_bool($sql)) {
$this->_reset();
if ($sql === FALSE) {
return $this->db->db_debug ? $this->db->display_error('db_unsupported_feature') : FALSE;
}
}
if (($result = $this->db->query($sql)) !== FALSE) {
empty($this->db->data_cache['table_names']) or $this->db->data_cache['table_names'][] = $table;
// Most databases don't support creating indexes from within the CREATE TABLE statement
if (!empty($this->keys)) {
for ($i = 0, $sqls = $this->_process_indexes($table), $c = count($sqls); $i < $c; $i++) {
$this->db->query($sqls[$i]);
}
}
}
$this->_reset();
return $result;
}