Below is the list of changes that have just been committed into a local
5.0 repository of mhansson. When mhansson 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@stripped, 2007-03-21 15:35:40+01:00, mhansson@stripped +2 -0
Merge mhansson@stripped:/home/bk/mysql-5.0-opt
into dl145s.mysql.com:/users/mhansson/mysql/autopush/5.0o-bug24791
MERGE: 1.2478.1.10
sql/field.h@stripped, 2007-03-21 15:35:36+01:00, mhansson@stripped +0 -0
Auto merged
MERGE: 1.196.1.1
sql/item_sum.cc@stripped, 2007-03-21 15:35:36+01:00, mhansson@stripped +0 -0
Auto merged
MERGE: 1.196.1.2
# 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: mhansson
# Host: dl145s.mysql.com
# Root: /users/mhansson/mysql/autopush/5.0o-bug24791/RESYNC
--- 1.197/sql/field.h 2007-03-13 13:58:47 +01:00
+++ 1.198/sql/field.h 2007-03-21 15:35:36 +01:00
@@ -432,6 +432,7 @@ public:
int store_decimal(const my_decimal *);
my_decimal *val_decimal(my_decimal *);
+ uint32 max_display_length() { return field_length; }
};
@@ -461,7 +462,6 @@ public:
void overflow(bool negative);
bool zero_pack() const { return 0; }
void sql_type(String &str) const;
- uint32 max_display_length() { return field_length; }
};
@@ -719,7 +719,6 @@ public:
void sort_string(char *buff,uint length);
uint32 pack_length() const { return sizeof(float); }
void sql_type(String &str) const;
- uint32 max_display_length() { return 24; }
};
@@ -762,7 +761,6 @@ public:
void sort_string(char *buff,uint length);
uint32 pack_length() const { return sizeof(double); }
void sql_type(String &str) const;
- uint32 max_display_length() { return 53; }
uint size_of() const { return sizeof(*this); }
};
--- 1.197/sql/item_sum.cc 2007-03-14 18:37:52 +01:00
+++ 1.198/sql/item_sum.cc 2007-03-21 15:35:36 +01:00
@@ -61,6 +61,7 @@ bool Item_sum::init_sum_func_check(THD *
/* Save a pointer to object to be used in items for nested set functions */
thd->lex->in_sum_func= this;
nest_level= thd->lex->current_select->nest_level;
+ nest_level_tables_count= thd->lex->current_select->join->tables;
ref_by= 0;
aggr_level= -1;
max_arg_level= -1;
@@ -176,6 +177,7 @@ bool Item_sum::check_sum_func(THD *thd,
*/
set_if_bigger(in_sum_func->max_sum_func_level, aggr_level);
}
+ update_used_tables();
thd->lex->in_sum_func= in_sum_func;
return FALSE;
}
@@ -267,12 +269,13 @@ bool Item_sum::register_sum_func(THD *th
sl= sl->master_unit()->outer_select() )
sl->master_unit()->item->with_sum_func= 1;
}
+ thd->lex->current_select->mark_as_dependent(aggr_sl);
return FALSE;
}
-Item_sum::Item_sum(List<Item> &list)
- :arg_count(list.elements)
+Item_sum::Item_sum(List<Item> &list) :arg_count(list.elements),
+ forced_const(FALSE)
{
if ((args=(Item**) sql_alloc(sizeof(Item*)*arg_count)))
{
@@ -296,7 +299,10 @@ Item_sum::Item_sum(List<Item> &list)
Item_sum::Item_sum(THD *thd, Item_sum *item):
Item_result_field(thd, item), arg_count(item->arg_count),
- quick_group(item->quick_group)
+ nest_level(item->nest_level), aggr_level(item->aggr_level),
+ quick_group(item->quick_group), used_tables_cache(item->used_tables_cache),
+ forced_const(item->forced_const),
+ nest_level_tables_count(item->nest_level_tables_count)
{
if (arg_count <= 2)
args=tmp_args;
@@ -426,6 +432,26 @@ case DECIMAL_RESULT:
}
+void Item_sum::update_used_tables ()
+{
+ if (!forced_const)
+ {
+ used_tables_cache= 0;
+ for (uint i=0 ; i < arg_count ; i++)
+ {
+ args[i]->update_used_tables();
+ used_tables_cache|= args[i]->used_tables();
+ }
+
+ used_tables_cache&= PSEUDO_TABLE_BITS;
+
+ /* the aggregate function is aggregated into its local context */
+ if (aggr_level == nest_level)
+ used_tables_cache |= (1 << nest_level_tables_count) - 1;
+ }
+}
+
+
String *
Item_sum_num::val_str(String *str)
{
@@ -485,7 +511,7 @@ Item_sum_num::fix_fields(THD *thd, Item
Item_sum_hybrid::Item_sum_hybrid(THD *thd, Item_sum_hybrid *item)
:Item_sum(thd, item), value(item->value), hybrid_type(item->hybrid_type),
hybrid_field_type(item->hybrid_field_type), cmp_sign(item->cmp_sign),
- used_table_cache(item->used_table_cache), was_values(item->was_values)
+ was_values(item->was_values)
{
/* copy results from old value */
switch (hybrid_type) {
@@ -1073,7 +1099,6 @@ void Item_sum_count::cleanup()
DBUG_ENTER("Item_sum_count::cleanup");
count= 0;
Item_sum_int::cleanup();
- used_table_cache= ~(table_map) 0;
DBUG_VOID_RETURN;
}
@@ -1556,7 +1581,7 @@ void Item_sum_hybrid::cleanup()
{
DBUG_ENTER("Item_sum_hybrid::cleanup");
Item_sum::cleanup();
- used_table_cache= ~(table_map) 0;
+ forced_const= FALSE;
/*
by default it is TRUE to avoid TRUE reporting by
| Thread |
|---|
| • bk commit into 5.0 tree (mhansson:1.2480) | mhansson | 21 Mar |