1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.0-opt

into  magare.gmz:/home/kgeorge/mysql/autopush/WL3527-5.0-opt-merge
This commit is contained in:
unknown
2007-03-11 10:10:33 +02:00
17 changed files with 99 additions and 30 deletions

View File

@ -1758,9 +1758,10 @@ void Item_ident::print(String *str)
}
}
if (!table_name || !field_name)
if (!table_name || !field_name || !field_name[0])
{
const char *nm= field_name ? field_name : name ? name : "tmp_field";
const char *nm= (field_name && field_name[0]) ?
field_name : name ? name : "tmp_field";
append_identifier(thd, str, nm, (uint) strlen(nm));
return;
}
@ -4916,6 +4917,22 @@ Item *Item_field::update_value_transformer(byte *select_arg)
}
void Item_field::print(String *str)
{
if (field && field->table->const_table)
{
char buff[MAX_FIELD_WIDTH];
String tmp(buff,sizeof(buff),str->charset());
field->val_str(&tmp);
str->append('\'');
str->append(tmp);
str->append('\'');
return;
}
Item_ident::print(str);
}
Item_ref::Item_ref(Name_resolution_context *context_arg,
Item **item, const char *table_name_arg,
const char *field_name_arg,

View File

@ -1303,6 +1303,7 @@ public:
Item *safe_charset_converter(CHARSET_INFO *tocs);
int fix_outer_field(THD *thd, Field **field, Item **reference);
virtual Item *update_value_transformer(byte *select_arg);
void print(String *str);
friend class Item_default_value;
friend class Item_insert_value;
friend class st_select_lex_unit;

View File

@ -1184,11 +1184,10 @@ void Item_func_substr::fix_length_and_dec()
if (args[1]->const_item())
{
int32 start= (int32) args[1]->val_int();
start= (int32)((start < 0) ? max_length + start : start - 1);
if (start < 0 || start >= (int32) max_length)
max_length=0; /* purecov: inspected */
if (start < 0)
max_length= ((uint)(-start) > max_length) ? 0 : (uint)(-start);
else
max_length-= (uint) start;
max_length-= min((uint)(start - 1), max_length);
}
if (arg_count == 3 && args[2]->const_item())
{

View File

@ -7504,7 +7504,7 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree)
if ((join->tables != 1) || /* The query must reference one table. */
((!join->group_list) && /* Neither GROUP BY nor a DISTINCT query. */
(!join->select_distinct)) ||
(thd->lex->select_lex.olap == ROLLUP_TYPE)) /* Check (B3) for ROLLUP */
(join->select_lex->olap == ROLLUP_TYPE)) /* Check (B3) for ROLLUP */
DBUG_RETURN(NULL);
if (table->s->keys == 0) /* There are no indexes to use. */
DBUG_RETURN(NULL);

View File

@ -621,6 +621,12 @@ bool st_select_lex_unit::cleanup()
join->tables= 0;
}
error|= fake_select_lex->cleanup();
if (fake_select_lex->order_list.elements)
{
ORDER *ord;
for (ord= (ORDER*)fake_select_lex->order_list.first; ord; ord= ord->next)
(*ord->item)->cleanup();
}
}
DBUG_RETURN(error);