mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Fixed that NULL and 0 returns 0 instead of NULL
This is coded to not cause a speed impact on top level AND expressions where we don't care if an AND expression returns 0 or NULL mysql-test/r/bdb.result: Fix results after serges last patch mysql-test/r/innodb.result: Fix results after serges last patch mysql-test/r/null.result: Update for new AND handling of NULL scripts/mysqld_safe.sh: Fix 'isroot' test to work even if user is not root sql/item.h: Fixed that NULL and 0 returns 0 instead of NULL sql/item_cmpfunc.cc: Fixed that NULL and 0 returns 0 instead of NULL sql/item_cmpfunc.h: Fixed that NULL and 0 returns 0 instead of NULL sql/sql_base.cc: Fixed that NULL and 0 returns 0 instead of NULL sql/sql_parse.cc: Fixed that NULL and 0 returns 0 instead of NULL sql/sql_select.cc: Fixed that NULL and 0 returns 0 instead of NULL sql/sql_yacc.yy: Fixed that NULL and 0 returns 0 instead of NULL
This commit is contained in:
@ -360,6 +360,7 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
|
||||
{
|
||||
conds->fix_fields(thd,tables);
|
||||
conds->change_ref_to_fields(thd,tables);
|
||||
conds->top_level_item();
|
||||
having=0;
|
||||
}
|
||||
}
|
||||
@ -869,6 +870,7 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
|
||||
sort_table_cond)))
|
||||
goto err;
|
||||
table->select_cond=table->select->cond;
|
||||
table->select_cond->top_level_item();
|
||||
DBUG_EXECUTE("where",print_where(table->select->cond,
|
||||
"select and having"););
|
||||
having=make_cond_for_table(having,~ (table_map) 0,~used_tables);
|
||||
@ -5490,6 +5492,7 @@ make_cond_for_table(COND *cond,table_map tables,table_map used_table)
|
||||
{
|
||||
if (((Item_cond*) cond)->functype() == Item_func::COND_AND_FUNC)
|
||||
{
|
||||
/* Create new top level AND item */
|
||||
Item_cond_and *new_cond=new Item_cond_and;
|
||||
if (!new_cond)
|
||||
DBUG_RETURN((COND*) 0); // OOM /* purecov: inspected */
|
||||
@ -5527,6 +5530,7 @@ make_cond_for_table(COND *cond,table_map tables,table_map used_table)
|
||||
new_cond->argument_list()->push_back(fix);
|
||||
}
|
||||
new_cond->used_tables_cache=((Item_cond_or*) cond)->used_tables_cache;
|
||||
new_cond->top_level_item();
|
||||
DBUG_RETURN(new_cond);
|
||||
}
|
||||
}
|
||||
@ -5886,6 +5890,7 @@ static bool fix_having(JOIN *join, Item **having)
|
||||
sort_table_cond)))
|
||||
DBUG_RETURN(1);
|
||||
table->select_cond=table->select->cond;
|
||||
table->select_cond->top_level_item();
|
||||
DBUG_EXECUTE("where",print_where(table->select_cond,
|
||||
"select and having"););
|
||||
*having=make_cond_for_table(*having,~ (table_map) 0,~used_tables);
|
||||
|
Reference in New Issue
Block a user