mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
Merge bk-internal.mysql.com:/home/bk/mysql-4.1/
into serg.mylan:/usr/home/serg/Abk/mysql-4.1 sql/sql_select.cc: Auto merged
This commit is contained in:
@@ -159,10 +159,7 @@ Item *Item_sum::get_tmp_table_item(THD *thd)
|
|||||||
if (!arg->const_item())
|
if (!arg->const_item())
|
||||||
{
|
{
|
||||||
if (arg->type() == Item::FIELD_ITEM)
|
if (arg->type() == Item::FIELD_ITEM)
|
||||||
{
|
|
||||||
arg->maybe_null= result_field_tmp->maybe_null();
|
|
||||||
((Item_field*) arg)->field= result_field_tmp++;
|
((Item_field*) arg)->field= result_field_tmp++;
|
||||||
}
|
|
||||||
else
|
else
|
||||||
sum_item->args[i]= new Item_field(result_field_tmp++);
|
sum_item->args[i]= new Item_field(result_field_tmp++);
|
||||||
}
|
}
|
||||||
|
@@ -4742,7 +4742,7 @@ static Field* create_tmp_field_from_item(THD *thd,
|
|||||||
copy_func If set and item is a function, store copy of item
|
copy_func If set and item is a function, store copy of item
|
||||||
in this array
|
in this array
|
||||||
from_field if field will be created using other field as example,
|
from_field if field will be created using other field as example,
|
||||||
pointer example field will be written here
|
pointer example field will be written here
|
||||||
group 1 if we are going to do a relative group by on result
|
group 1 if we are going to do a relative group by on result
|
||||||
modify_item 1 if item->result_field should point to new item.
|
modify_item 1 if item->result_field should point to new item.
|
||||||
This is relevent for how fill_record() is going to
|
This is relevent for how fill_record() is going to
|
||||||
@@ -4751,7 +4751,7 @@ static Field* create_tmp_field_from_item(THD *thd,
|
|||||||
the record in the original table.
|
the record in the original table.
|
||||||
If modify_item is 0 then fill_record() will update
|
If modify_item is 0 then fill_record() will update
|
||||||
the temporary table
|
the temporary table
|
||||||
|
|
||||||
RETURN
|
RETURN
|
||||||
0 on error
|
0 on error
|
||||||
new_created field
|
new_created field
|
||||||
@@ -4775,13 +4775,13 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
|
|||||||
return new Field_double(item_sum->max_length,maybe_null,
|
return new Field_double(item_sum->max_length,maybe_null,
|
||||||
item->name, table, item_sum->decimals);
|
item->name, table, item_sum->decimals);
|
||||||
case Item_sum::VARIANCE_FUNC: /* Place for sum & count */
|
case Item_sum::VARIANCE_FUNC: /* Place for sum & count */
|
||||||
case Item_sum::STD_FUNC:
|
case Item_sum::STD_FUNC:
|
||||||
if (group)
|
if (group)
|
||||||
return new Field_string(sizeof(double)*2+sizeof(longlong),
|
return new Field_string(sizeof(double)*2+sizeof(longlong),
|
||||||
0, item->name,table,&my_charset_bin);
|
0, item->name,table,&my_charset_bin);
|
||||||
else
|
else
|
||||||
return new Field_double(item_sum->max_length, maybe_null,
|
return new Field_double(item_sum->max_length, maybe_null,
|
||||||
item->name,table,item_sum->decimals);
|
item->name,table,item_sum->decimals);
|
||||||
case Item_sum::UNIQUE_USERS_FUNC:
|
case Item_sum::UNIQUE_USERS_FUNC:
|
||||||
return new Field_long(9,maybe_null,item->name,table,1);
|
return new Field_long(9,maybe_null,item->name,table,1);
|
||||||
default:
|
default:
|
||||||
@@ -4889,7 +4889,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
|
|||||||
else // if we run out of slots or we are not using tempool
|
else // if we run out of slots or we are not using tempool
|
||||||
sprintf(path,"%s%s%lx_%lx_%x",mysql_tmpdir,tmp_file_prefix,current_pid,
|
sprintf(path,"%s%s%lx_%lx_%x",mysql_tmpdir,tmp_file_prefix,current_pid,
|
||||||
thd->thread_id, thd->tmp_table++);
|
thd->thread_id, thd->tmp_table++);
|
||||||
|
|
||||||
if (lower_case_table_names)
|
if (lower_case_table_names)
|
||||||
my_casedn_str(files_charset_info, path);
|
my_casedn_str(files_charset_info, path);
|
||||||
|
|
||||||
@@ -5005,16 +5005,21 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
|
|||||||
tmp_from_field++;
|
tmp_from_field++;
|
||||||
*(reg_field++)= new_field;
|
*(reg_field++)= new_field;
|
||||||
reclength+=new_field->pack_length();
|
reclength+=new_field->pack_length();
|
||||||
if (!(new_field->flags & NOT_NULL_FLAG))
|
|
||||||
null_count++;
|
|
||||||
if (new_field->flags & BLOB_FLAG)
|
if (new_field->flags & BLOB_FLAG)
|
||||||
{
|
{
|
||||||
*blob_field++= new_field;
|
*blob_field++= new_field;
|
||||||
blob_count++;
|
blob_count++;
|
||||||
}
|
}
|
||||||
((Item_sum*) item)->args[i]= new Item_field(new_field);
|
((Item_sum*) item)->args[i]= new Item_field(new_field);
|
||||||
if (((Item_sum*) item)->arg_count == 1)
|
if (!(new_field->flags & NOT_NULL_FLAG))
|
||||||
((Item_sum*) item)->result_field= new_field;
|
{
|
||||||
|
null_count++;
|
||||||
|
/*
|
||||||
|
new_field->maybe_null() is still false, it will be
|
||||||
|
changed below. But we have to setup Item_field correctly
|
||||||
|
*/
|
||||||
|
((Item_sum*) item)->args[i]->maybe_null=1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user