summaryrefslogtreecommitdiff
path: root/sql/sql_select.cc
diff options
context:
space:
mode:
authorunknown <kaa@polly.local>2007-06-12 09:42:19 +0400
committerunknown <kaa@polly.local>2007-06-12 09:42:19 +0400
commitd16084b472b631451ff1e853a2eebbf3dd9ef842 (patch)
treedb783327c0188247e14fbbcee091540344c037c1 /sql/sql_select.cc
parent4a33f4cede1d4821b48f2a708120617d03878942 (diff)
parentbf352ec258c962b34e0e1feaaefc5980b27d90bd (diff)
downloadmariadb-git-d16084b472b631451ff1e853a2eebbf3dd9ef842.tar.gz
Merge polly.local:/home/kaa/src/maint/bug28895/my50-bug28895
into polly.local:/home/kaa/src/maint/bug28895/my51-bug28895 sql/sql_select.cc: Manual merge.
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r--sql/sql_select.cc19
1 files changed, 11 insertions, 8 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 364dcd6e159..198eed44b89 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -9364,7 +9364,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
bool using_unique_constraint= 0;
bool use_packed_rows= 0;
bool not_all_columns= !(select_options & TMP_TABLE_ALL_COLUMNS);
- char *tmpname,path[FN_REFLEN];
+ char *tmpname, *tmppath, path[FN_REFLEN], table_name[NAME_LEN+1];
byte *pos, *group_buff, *bitmaps;
uchar *null_flags;
Field **reg_field, **from_field, **default_field;
@@ -9388,12 +9388,12 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
temp_pool_slot = bitmap_lock_set_next(&temp_pool);
if (temp_pool_slot != MY_BIT_NONE) // we got a slot
- sprintf(path, "%s_%lx_%i", tmp_file_prefix,
- current_pid, temp_pool_slot);
+ sprintf(table_name, "%s_%lx_%i", tmp_file_prefix,
+ current_pid, temp_pool_slot);
else
{
/* if we run out of slots or we are not using tempool */
- sprintf(path,"%s%lx_%lx_%x", tmp_file_prefix,current_pid,
+ sprintf(table_name, "%s%lx_%lx_%x", tmp_file_prefix,current_pid,
thd->thread_id, thd->tmp_table++);
}
@@ -9401,7 +9401,8 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
No need to change table name to lower case as we are only creating
MyISAM or HEAP tables here
*/
- fn_format(path, path, mysql_tmpdir, "", MY_REPLACE_EXT|MY_UNPACK_FILENAME);
+ fn_format(path, table_name, mysql_tmpdir, "",
+ MY_REPLACE_EXT|MY_UNPACK_FILENAME);
if (group)
{
@@ -9447,7 +9448,8 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
sizeof(*key_part_info)*(param->group_parts+1),
&param->start_recinfo,
sizeof(*param->recinfo)*(field_count*2+4),
- &tmpname, (uint) strlen(path)+1,
+ &tmppath, (uint) strlen(path)+1,
+ &tmpname, (uint) strlen(table_name)+1,
&group_buff, (group && ! using_unique_constraint ?
param->group_length : 0),
&bitmaps, bitmap_buffer_size(field_count)*2,
@@ -9466,7 +9468,8 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
DBUG_RETURN(NULL); /* purecov: inspected */
}
param->items_to_copy= copy_func;
- strmov(tmpname,path);
+ strmov(tmppath, path);
+ strmov(tmpname, table_name);
/* make table according to fields */
bzero((char*) table,sizeof(*table));
@@ -9491,7 +9494,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
table->keys_in_use_for_query.init();
table->s= share;
- init_tmp_table_share(share, "", 0, tmpname, tmpname);
+ init_tmp_table_share(share, "", 0, tmpname, tmppath);
share->blob_field= blob_field;
share->blob_ptr_size= mi_portable_sizeof_char_ptr;
share->db_low_byte_first=1; // True for HEAP and MyISAM