1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00

Merge mysql.com:/nfsdisk1/lars/bkroot/mysql-5.0-rpl

into  mysql.com:/nfsdisk1/lars/MERGE/mysql-5.0-merge
This commit is contained in:
lars/lthalmann@mysql.com/dl145h.mysql.com
2007-03-31 12:36:50 +02:00
34 changed files with 901 additions and 293 deletions

View File

@ -412,7 +412,12 @@ JOIN::prepare(Item ***rref_pointer_array,
&select_lex->leaf_tables, FALSE,
SELECT_ACL, SELECT_ACL))
DBUG_RETURN(-1);
tables= thd->leaf_count;
TABLE_LIST *table_ptr;
for (table_ptr= select_lex->leaf_tables;
table_ptr;
table_ptr= table_ptr->next_leaf)
tables++;
if (setup_wild(thd, tables_list, fields_list, &all_fields, wild_num) ||
select_lex->setup_ref_array(thd, og_num) ||
@ -8788,20 +8793,19 @@ static Field *create_tmp_field_from_item(THD *thd, Item *item, TABLE *table,
enum enum_field_types type;
/*
DATE/TIME fields have STRING_RESULT result type. To preserve
type they needed to be handled separately.
DATE/TIME and GEOMETRY fields have STRING_RESULT result type.
To preserve type they needed to be handled separately.
*/
if ((type= item->field_type()) == MYSQL_TYPE_DATETIME ||
type == MYSQL_TYPE_TIME || type == MYSQL_TYPE_DATE ||
type == MYSQL_TYPE_TIMESTAMP)
type == MYSQL_TYPE_TIMESTAMP || type == MYSQL_TYPE_GEOMETRY)
new_field= item->tmp_table_field_from_field_type(table);
/*
Make sure that the blob fits into a Field_varstring which has
2-byte lenght.
*/
else if (item->max_length/item->collation.collation->mbmaxlen > 255 &&
item->max_length/item->collation.collation->mbmaxlen < UINT_MAX16
&& convert_blob_length)
convert_blob_length < UINT_MAX16 && convert_blob_length)
new_field= new Field_varstring(convert_blob_length, maybe_null,
item->name, table,
item->collation.collation);
@ -9193,13 +9197,19 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
{
if (item->with_sum_func && type != Item::SUM_FUNC_ITEM)
{
/*
Mark that the we have ignored an item that refers to a summary
function. We need to know this if someone is going to use
DISTINCT on the result.
*/
param->using_indirect_summary_function=1;
continue;
if (item->used_tables() & OUTER_REF_TABLE_BIT)
item->update_used_tables();
if (type == Item::SUBSELECT_ITEM ||
(item->used_tables() & ~OUTER_REF_TABLE_BIT))
{
/*
Mark that the we have ignored an item that refers to a summary
function. We need to know this if someone is going to use
DISTINCT on the result.
*/
param->using_indirect_summary_function=1;
continue;
}
}
if (item->const_item() && (int) hidden_field_count <= 0)
continue; // We don't have to store this
@ -9384,6 +9394,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
table->s->default_values= table->record[1]+alloc_length;
}
copy_func[0]=0; // End marker
param->func_count= copy_func - param->items_to_copy;
recinfo=param->start_recinfo;
null_flags=(uchar*) table->record[0];
@ -13564,6 +13575,7 @@ count_field_types(TMP_TABLE_PARAM *param, List<Item> &fields,
if (!sum_item->quick_group)
param->quick_group=0; // UDF SUM function
param->sum_func_count++;
param->func_count++;
for (uint i=0 ; i < sum_item->arg_count ; i++)
{