diff options
author | unknown <dkatz@damien-katzs-computer.local> | 2007-04-30 17:51:57 -0400 |
---|---|---|
committer | unknown <dkatz@damien-katzs-computer.local> | 2007-04-30 17:51:57 -0400 |
commit | 0fc282bbe190cce5a32754f606456fe363a6b194 (patch) | |
tree | 53fbc7ae9143605227941990d2ab2d3326cdb49c | |
parent | 930912f8324e53d1bad816b26ce880bf63ae58fa (diff) | |
parent | 2127e26dda375d5de71804ce888d56d0eb28f428 (diff) | |
download | mariadb-git-0fc282bbe190cce5a32754f606456fe363a6b194.tar.gz |
Merge dkatz@bk-internal.mysql.com:/home/bk/mysql-5.0-maint
into damien-katzs-computer.local:/Users/dkatz/mysql50
-rw-r--r-- | mysql-test/include/have_lowercase1.inc | 4 | ||||
-rw-r--r-- | mysql-test/lib/mtr_report.pl | 4 | ||||
-rw-r--r-- | mysql-test/r/lowercase1.require | 2 | ||||
-rw-r--r-- | mysql-test/r/lowercase_mixed_tmpdir.result | 6 | ||||
-rw-r--r-- | mysql-test/t/lowercase_mixed_tmpdir-master.opt | 2 | ||||
-rw-r--r-- | mysql-test/t/lowercase_mixed_tmpdir-master.sh | 6 | ||||
-rw-r--r-- | mysql-test/t/lowercase_mixed_tmpdir.test | 12 | ||||
-rw-r--r-- | sql/sql_table.cc | 26 |
8 files changed, 50 insertions, 12 deletions
diff --git a/mysql-test/include/have_lowercase1.inc b/mysql-test/include/have_lowercase1.inc new file mode 100644 index 00000000000..1b33432dbe3 --- /dev/null +++ b/mysql-test/include/have_lowercase1.inc @@ -0,0 +1,4 @@ +--require r/lowercase1.require +--disable_query_log +show variables like 'lower_case_table_names'; +--enable_query_log diff --git a/mysql-test/lib/mtr_report.pl b/mysql-test/lib/mtr_report.pl index a2f22ef8870..d08208d37a6 100644 --- a/mysql-test/lib/mtr_report.pl +++ b/mysql-test/lib/mtr_report.pl @@ -238,7 +238,7 @@ sub mtr_report_stats ($) { } if (!$::opt_extern) { - print "The servers where restarted $tot_restarts times\n"; + print "The servers were restarted $tot_restarts times\n"; } if ( $::opt_timer ) @@ -357,7 +357,7 @@ sub mtr_report_stats ($) { if ( $tot_failed != 0 || $found_problems) { - mtr_error("there where failing test cases"); + mtr_error("there were failing test cases"); } } diff --git a/mysql-test/r/lowercase1.require b/mysql-test/r/lowercase1.require new file mode 100644 index 00000000000..0341f838f7b --- /dev/null +++ b/mysql-test/r/lowercase1.require @@ -0,0 +1,2 @@ +Variable_name Value +lower_case_table_names 1 diff --git a/mysql-test/r/lowercase_mixed_tmpdir.result b/mysql-test/r/lowercase_mixed_tmpdir.result new file mode 100644 index 00000000000..e11b5e4c286 --- /dev/null +++ b/mysql-test/r/lowercase_mixed_tmpdir.result @@ -0,0 +1,6 @@ +drop table if exists t1; +create table t1 (id int) engine=myisam; +insert into t1 values (1); +create temporary table t2 select * from t1; +drop temporary table t2; +drop table t1; diff --git a/mysql-test/t/lowercase_mixed_tmpdir-master.opt b/mysql-test/t/lowercase_mixed_tmpdir-master.opt new file mode 100644 index 00000000000..3d21ea72f6b --- /dev/null +++ b/mysql-test/t/lowercase_mixed_tmpdir-master.opt @@ -0,0 +1,2 @@ +--lower-case-table-names=1 +--tmpdir=$MYSQLTEST_VARDIR/tmp/MixedCase diff --git a/mysql-test/t/lowercase_mixed_tmpdir-master.sh b/mysql-test/t/lowercase_mixed_tmpdir-master.sh new file mode 100644 index 00000000000..95c26e3aa02 --- /dev/null +++ b/mysql-test/t/lowercase_mixed_tmpdir-master.sh @@ -0,0 +1,6 @@ +# This test requires a non-lowercase tmpdir directory on a case-sensitive +# filesystem. + +d="$MYSQLTEST_VARDIR/tmp/MixedCase" +test -d "$d" || mkdir "$d" +rm -f "$d"/* diff --git a/mysql-test/t/lowercase_mixed_tmpdir.test b/mysql-test/t/lowercase_mixed_tmpdir.test new file mode 100644 index 00000000000..6bd3a6f2acc --- /dev/null +++ b/mysql-test/t/lowercase_mixed_tmpdir.test @@ -0,0 +1,12 @@ +--source include/have_case_sensitive_file_system.inc +--source include/have_lowercase1.inc + +--disable_warnings +drop table if exists t1; +--enable_warnings + +create table t1 (id int) engine=myisam; +insert into t1 values (1); +create temporary table t2 select * from t1; +drop temporary table t2; +drop table t1; diff --git a/sql/sql_table.cc b/sql/sql_table.cc index f7478691293..42d59a10712 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -42,6 +42,7 @@ static int copy_data_between_tables(TABLE *from,TABLE *to, static bool prepare_blob_field(THD *thd, create_field *sql_field); static bool check_engine(THD *thd, const char *table_name, enum db_type *new_engine); +static void set_tmp_file_path(char *buf, size_t bufsize, THD *thd); /* @@ -1681,11 +1682,7 @@ bool mysql_create_table(THD *thd,const char *db, const char *table_name, /* Check if table exists */ if (create_info->options & HA_LEX_CREATE_TMP_TABLE) { - my_snprintf(path, sizeof(path), "%s%s%lx_%lx_%x%s", - mysql_tmpdir, tmp_file_prefix, current_pid, thd->thread_id, - thd->tmp_table++, reg_ext); - if (lower_case_table_names) - my_casedn_str(files_charset_info, path); + set_tmp_file_path(path, sizeof(path), thd); create_info->table_options|=HA_CREATE_DELAY_KEY_WRITE; } else @@ -2801,11 +2798,7 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, { if (find_temporary_table(thd, db, table_name)) goto table_exists; - my_snprintf(dst_path, sizeof(dst_path), "%s%s%lx_%lx_%x%s", - mysql_tmpdir, tmp_file_prefix, current_pid, - thd->thread_id, thd->tmp_table++, reg_ext); - if (lower_case_table_names) - my_casedn_str(files_charset_info, dst_path); + set_tmp_file_path(dst_path, sizeof(dst_path), thd); create_info->table_options|= HA_CREATE_DELAY_KEY_WRITE; } else @@ -4319,3 +4312,16 @@ static bool check_engine(THD *thd, const char *table_name, } return FALSE; } + +static void set_tmp_file_path(char *buf, size_t bufsize, THD *thd) +{ + char *p= strnmov(buf, mysql_tmpdir, bufsize); + my_snprintf(p, bufsize - (p - buf), "%s%lx_%lx_%x%s", + tmp_file_prefix, current_pid, + thd->thread_id, thd->tmp_table++, reg_ext); + if (lower_case_table_names) + { + /* Convert all except tmpdir to lower case */ + my_casedn_str(files_charset_info, p); + } +} |