From: Date: January 23 2006 1:28pm Subject: bk commit into 5.1 tree (msvensson:1.2077) BUG#15904 List-Archive: http://lists.mysql.com/commits/1492 X-Bug: 15904 Message-Id: <20060123122849.CA651207825@localhost.localdomain> Below is the list of changes that have just been committed into a local 5.1 repository of msvensson. When msvensson does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet 1.2077 06/01/23 13:28:42 msvensson@neptunus.(none) +1 -0 Bug#15904 --tmpdir requires trailing slash '/' - Use same code for creating the temptable filename both from "mysql_create_table" and "mysql_create_like_table" sql/sql_table.cc 1.298 06/01/23 13:28:37 msvensson@neptunus.(none) +10 -15 Move common functionality to crate a temptable name into "build_tmptable_filename", call it both from "mysql_create_table" and "mysql_create_like_table" # This is a BitKeeper patch. What follows are the unified diffs for the # set of deltas contained in the patch. The rest of the patch, the part # that BitKeeper cares about, is below these diffs. # User: msvensson # Host: neptunus.(none) # Root: /home/msvensson/mysql/bug15904/my51-bug15904 --- 1.297/sql/sql_table.cc 2006-01-19 03:56:01 +01:00 +++ 1.298/sql/sql_table.cc 2006-01-23 13:28:37 +01:00 @@ -122,14 +122,17 @@ } -uint build_tmptable_filename(char *buff, size_t bufflen, - const char *tmpdir, - const char *table, const char *ext) +uint build_tmptable_filename(THD* thd, char *buff, size_t bufflen) { uint length; char tbbuff[FN_REFLEN]; - VOID(tablename_to_filename(table, tbbuff, sizeof(tbbuff))); - strxnmov(buff, bufflen, tmpdir, "/", tbbuff, ext, NullS); + char tmp_table_name[tmp_file_prefix_length+22+22+22+3]; + my_snprintf(tmp_table_name, sizeof(tmp_table_name), + "%s%lx_%lx_%x", + tmp_file_prefix, current_pid, + thd->thread_id, thd->tmp_table++); + VOID(tablename_to_filename(tmp_table_name, tbbuff, sizeof(tbbuff))); + strxnmov(buff, bufflen, mysql_tmpdir, "/", tbbuff, reg_ext, NullS); length= unpack_filename(buff, buff); return length; } @@ -2168,12 +2171,7 @@ /* Check if table exists */ if (create_info->options & HA_LEX_CREATE_TMP_TABLE) { - char tmp_table_name[tmp_file_prefix_length+22+22+22+3]; - my_snprintf(tmp_table_name, sizeof(tmp_table_name), "%s%lx_%lx_%x", - tmp_file_prefix, current_pid, thd->thread_id, - thd->tmp_table++); - path_length= build_tmptable_filename(path, sizeof(path), mysql_tmpdir, - tmp_table_name, reg_ext); + path_length= build_tmptable_filename(thd, path, sizeof(path)); if (lower_case_table_names) my_casedn_str(files_charset_info, path); create_info->table_options|=HA_CREATE_DELAY_KEY_WRITE; @@ -3358,10 +3356,7 @@ { if (find_temporary_table(thd, db, table_name)) goto table_exists; - dst_path_length= 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); + dst_path_length= build_tmptable_filename(thd, dst_path, sizeof(dst_path)); if (lower_case_table_names) my_casedn_str(files_charset_info, dst_path); create_info->table_options|= HA_CREATE_DELAY_KEY_WRITE;