1193
1192
×tamps, ×tamps_with_niladic,
1194
1193
file->ha_table_flags()))
1196
if (sql_field->sql_type == DRIZZLE_TYPE_VARCHAR)
1197
create_info->varchar= true;
1198
1195
sql_field->offset= record_offset;
1199
1196
if (MTYP_TYPENR(sql_field->unireg_check) == Field::NEXT_NUMBER)
1200
1197
auto_increment++;
1770
1766
path_length= build_table_filename(path, sizeof(path), db, table_name, internal_tmp_table);
1774
* If the DATA DIRECTORY or INDEX DIRECTORY options are specified in the
1775
* create table statement, check whether the storage engine supports those
1776
* options. If not, return an appropriate error.
1778
if (create_info->data_file_name &&
1779
! create_info->db_type->check_flag(HTON_BIT_DATA_DIR))
1781
my_error(ER_ILLEGAL_HA_CREATE_OPTION, MYF(0),
1782
create_info->db_type->getName().c_str(),
1787
if (create_info->index_file_name &&
1788
! create_info->db_type->check_flag(HTON_BIT_INDEX_DIR))
1790
my_error(ER_ILLEGAL_HA_CREATE_OPTION, MYF(0),
1791
create_info->db_type->getName().c_str(),
1796
1769
/* Check if table already exists */
1797
1770
if ((create_info->options & HA_LEX_CREATE_TMP_TABLE) &&
1798
1771
session->find_temporary_table(db, table_name))
1890
1863
session->set_proc_info("creating table");
1891
1864
create_info->table_existed= 0; // Mark that table is created
1893
#ifdef HAVE_READLINK
1894
if (test_if_data_home_dir(create_info->data_file_name))
1896
my_error(ER_WRONG_ARGUMENTS, MYF(0), "DATA DIRECTORY");
1897
goto unlock_and_end;
1899
if (test_if_data_home_dir(create_info->index_file_name))
1901
my_error(ER_WRONG_ARGUMENTS, MYF(0), "INDEX DIRECTORY");
1902
goto unlock_and_end;
1906
#endif /* HAVE_READLINK */
1908
if (create_info->data_file_name)
1909
push_warning(session, DRIZZLE_ERROR::WARN_LEVEL_WARN, 0,
1910
"DATA DIRECTORY option ignored");
1911
if (create_info->index_file_name)
1912
push_warning(session, DRIZZLE_ERROR::WARN_LEVEL_WARN, 0,
1913
"INDEX DIRECTORY option ignored");
1914
create_info->data_file_name= create_info->index_file_name= 0;
1916
1866
create_info->table_options=db_options;
1918
1868
if (rea_create_table(session, path, db, table_name,
2962
2912
char *tmp_name,
2963
2913
HA_CREATE_INFO *create_info,
2964
2914
drizzled::message::Table *create_proto,
2965
Alter_info *alter_info,
2915
Alter_info *alter_info)
2969
char index_file[FN_REFLEN], data_file[FN_REFLEN];
2970
2918
StorageEngine *old_db_type, *new_db_type;
2971
2919
old_db_type= table->s->db_type();
2972
2920
new_db_type= create_info->db_type;
2974
Handling of symlinked tables:
2976
Create new data file and index file on the same disk as the
2977
old data and index files.
2979
Rename new data file over old data file and new index file over
2981
Symlinks are not changed.
2984
Create new data file and index file on the same disk as the
2985
old data and index files. Create also symlinks to point at
2988
At end, rename intermediate tables, and symlinks to intermediate
2989
table, to final table name.
2990
Remove old table and old symlinks
2992
If rename is made to another database:
2993
Create new tables in new database.
2995
Remove old table and symlinks.
2997
if (db_changed) // Ignore symlink if db changed
2999
if (create_info->index_file_name)
3001
/* Fix index_file_name to have 'tmp_name' as basename */
3002
strcpy(index_file, tmp_name);
3003
create_info->index_file_name=fn_same(index_file,
3004
create_info->index_file_name,
3007
if (create_info->data_file_name)
3009
/* Fix data_file_name to have 'tmp_name' as basename */
3010
strcpy(data_file, tmp_name);
3011
create_info->data_file_name=fn_same(data_file,
3012
create_info->data_file_name,
3017
create_info->data_file_name=create_info->index_file_name=0;
3020
2922
Create a table with a temporary name.
3021
2923
We don't log the statement, it will be logged later.
3784
3685
my_casedn_str(files_charset_info, tmp_name);
3786
3687
/* Create a temporary table with the new format */
3787
error= create_temporary_table(session, table, new_db, tmp_name, create_info, create_proto, alter_info, !strcmp(db, new_db));
3688
error= create_temporary_table(session, table, new_db, tmp_name, create_info, create_proto, alter_info);
3788
3689
if (error != 0)