summaryrefslogtreecommitdiff
path: root/sql/handler.cc
diff options
context:
space:
mode:
authorunknown <tsmith@quadxeon.mysql.com>2007-06-15 01:57:33 +0200
committerunknown <tsmith@quadxeon.mysql.com>2007-06-15 01:57:33 +0200
commite64172b9e5ca67baca94915fa2c25372f8359f9c (patch)
tree4e46aab8d2631db6cd28c72c3633307314281d7e /sql/handler.cc
parent57cac5df0929f5fdf3aabc12ec63be037e28392b (diff)
parent78d4f418c362874a8367cc19fd219e2c11e2ea6e (diff)
downloadmariadb-git-e64172b9e5ca67baca94915fa2c25372f8359f9c.tar.gz
Merge tsmith@bk-internal.mysql.com:/home/bk/mysql-5.1-build
into quadxeon.mysql.com:/benchmarks/ext3/TOSAVE/tsmith/bk/maint/jun14/51 configure.in: Auto merged BitKeeper/deleted/.del-ctype_cp932_notembedded.test~3047e508460cef42: Auto merged mysql-test/extra/binlog_tests/binlog.test: Auto merged mysql-test/extra/binlog_tests/blackhole.test: Auto merged mysql-test/extra/binlog_tests/ctype_cp932_binlog.test: Auto merged mysql-test/extra/binlog_tests/ctype_ucs_binlog.test: Auto merged mysql-test/extra/binlog_tests/drop_temp_table.test: Auto merged mysql-test/extra/binlog_tests/insert_select-binlog.test: Auto merged mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test: Auto merged mysql-test/include/mix1.inc: Auto merged mysql-test/mysql-test-run.pl: Auto merged mysql-test/r/binlog_stm_binlog.result: Auto merged mysql-test/r/binlog_stm_mix_innodb_myisam.result: Auto merged mysql-test/r/have_log_bin.require: Auto merged mysql-test/t/flush_block_commit_notembedded.test: Auto merged mysql-test/t/insert_update.test: Auto merged mysql-test/t/mysqlbinlog-cp932.test: Auto merged mysql-test/t/mysqlbinlog2.test: Auto merged mysql-test/t/mysqldump.test: Auto merged mysql-test/t/ps.test: Auto merged mysql-test/t/sp_trans.test: Auto merged sql/handler.cc: Auto merged sql/sql_parse.cc: Auto merged sql/sql_select.cc: Auto merged mysql-test/r/date_formats.result: Use local mysql-test/r/partition.result: SCCS merged mysql-test/t/date_formats.test: Use local mysql-test/t/ndb_basic.test: manual merge mysql-test/t/partition.test: manual merge mysql-test/t/user_var-binlog.test: use local
Diffstat (limited to 'sql/handler.cc')
-rw-r--r--sql/handler.cc47
1 files changed, 24 insertions, 23 deletions
diff --git a/sql/handler.cc b/sql/handler.cc
index 8d656c4c89d..1a468f306e3 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -1392,6 +1392,25 @@ bool ha_flush_logs(handlerton *db_type)
return FALSE;
}
+static const char *check_lowercase_names(handler *file, const char *path,
+ char *tmp_path)
+{
+ if (lower_case_table_names != 2 || (file->ha_table_flags() & HA_FILE_BASED))
+ return path;
+
+ /* Ensure that table handler get path in lower case */
+ if (tmp_path != path)
+ strmov(tmp_path, path);
+
+ /*
+ we only should turn into lowercase database/table part
+ so start the process after homedirectory
+ */
+ my_casedn_str(files_charset_info, tmp_path + mysql_data_home_len);
+ return tmp_path;
+}
+
+
/** @brief
This should return ENOENT if the file doesn't exists.
The .frm file will be deleted only if we return 0 or ENOENT
@@ -1415,13 +1434,7 @@ int ha_delete_table(THD *thd, handlerton *table_type, const char *path,
! (file=get_new_handler((TABLE_SHARE*)0, thd->mem_root, table_type)))
DBUG_RETURN(ENOENT);
- if (lower_case_table_names == 2 && !(file->ha_table_flags() & HA_FILE_BASED))
- {
- /* Ensure that table handler get path in lower case */
- strmov(tmp_path, path);
- my_casedn_str(files_charset_info, tmp_path);
- path= tmp_path;
- }
+ path= check_lowercase_names(file, path, tmp_path);
if ((error= file->delete_table(path)) && generate_warning)
{
/*
@@ -2597,15 +2610,7 @@ int ha_create_table(THD *thd, const char *path,
if (update_create_info)
update_create_info_from_table(create_info, &table);
- name= share.path.str;
- if (lower_case_table_names == 2 &&
- !(table.file->ha_table_flags() & HA_FILE_BASED))
- {
- /* Ensure that handler gets name in lower case */
- strmov(name_buff, name);
- my_casedn_str(files_charset_info, name_buff);
- name= name_buff;
- }
+ name= check_lowercase_names(table.file, share.path.str, name_buff);
error= table.file->create(name, &table, create_info);
VOID(closefrm(&table, 0));
@@ -2655,7 +2660,8 @@ int ha_create_table_from_engine(THD* thd, const char *db, const char *name)
frmblob and frmlen are set, write the frm to disk
*/
- (void)strxnmov(path,FN_REFLEN-1,mysql_data_home,"/",db,"/",name,NullS);
+ (void)strxnmov(path,FN_REFLEN-1,mysql_data_home,FN_ROOTDIR,
+ db,FN_ROOTDIR,name,NullS);
// Save the frm file
error= writefrm(path, frmblob, frmlen);
my_free(frmblob, MYF(0));
@@ -2676,12 +2682,7 @@ int ha_create_table_from_engine(THD* thd, const char *db, const char *name)
update_create_info_from_table(&create_info, &table);
create_info.table_options|= HA_OPTION_CREATE_FROM_ENGINE;
- if (lower_case_table_names == 2 &&
- !(table.file->ha_table_flags() & HA_FILE_BASED))
- {
- /* Ensure that handler gets name in lower case */
- my_casedn_str(files_charset_info, path);
- }
+ check_lowercase_names(table.file, path, path);
error=table.file->create(path,&table,&create_info);
VOID(closefrm(&table, 1));