summaryrefslogtreecommitdiff
path: root/sql/sql_select.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r--sql/sql_select.cc66
1 files changed, 32 insertions, 34 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 333e97d07ef..ae5cd82da4c 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -2561,7 +2561,7 @@ int JOIN::optimize_stage2()
if (!conds && outer_join)
{
/* Handle the case where we have an OUTER JOIN without a WHERE */
- conds= (Item*) &Item_true;
+ conds= (Item*) Item_true;
}
if (impossible_where)
@@ -2731,9 +2731,7 @@ int JOIN::optimize_stage2()
if (conds && const_table_map != found_const_table_map &&
(select_options & SELECT_DESCRIBE))
- {
- conds= (Item*) &Item_false;
- }
+ conds= (Item*) Item_false;
/* Cache constant expressions in WHERE, HAVING, ON clauses. */
cache_const_exprs();
@@ -3050,7 +3048,7 @@ int JOIN::optimize_stage2()
having= having->remove_eq_conds(thd, &select_lex->having_value, true);
if (select_lex->having_value == Item::COND_FALSE)
{
- having= (Item*) &Item_false;
+ having= (Item*) Item_false;
zero_result_cause= "Impossible HAVING noticed after reading const tables";
error= 0;
select_lex->mark_const_derived(zero_result_cause);
@@ -4974,6 +4972,7 @@ mysql_select(THD *thd, TABLE_LIST *tables, List<Item> &fields, COND *conds,
}
}
+ thd->get_stmt_da()->reset_current_row_for_warning(1);
/* Look for a table owned by an engine with the select_handler interface */
select_lex->pushdown_select= find_select_handler(thd, select_lex);
@@ -5636,7 +5635,7 @@ make_join_statistics(JOIN *join, List<TABLE_LIST> &tables_list,
if (join->cond_value == Item::COND_FALSE)
{
join->impossible_where= true;
- conds= (Item*) &Item_false;
+ conds= (Item*) Item_false;
}
join->cond_equal= NULL;
@@ -7117,7 +7116,7 @@ update_ref_and_keys(THD *thd, DYNAMIC_ARRAY *keyuse,JOIN_TAB *join_tab,
/* set a barrier for the array of SARGABLE_PARAM */
(*sargables)[0].field= 0;
- if (my_init_dynamic_array2(thd->mem_root->m_psi_key, keyuse, sizeof(KEYUSE),
+ if (my_init_dynamic_array2(thd->mem_root->psi_key, keyuse, sizeof(KEYUSE),
thd->alloc(sizeof(KEYUSE) * 20), 20, 64,
MYF(MY_THREAD_SPECIFIC)))
DBUG_RETURN(TRUE);
@@ -11922,7 +11921,7 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
below to check if we should use 'quick' instead.
*/
DBUG_PRINT("info", ("Item_int"));
- tmp= (Item*) &Item_true;
+ tmp= (Item*) Item_true;
}
}
@@ -12466,9 +12465,9 @@ static
bool generate_derived_keys(DYNAMIC_ARRAY *keyuse_array)
{
KEYUSE *keyuse= dynamic_element(keyuse_array, 0, KEYUSE*);
- uint elements= keyuse_array->elements;
+ size_t elements= keyuse_array->elements;
TABLE *prev_table= 0;
- for (uint i= 0; i < elements; i++, keyuse++)
+ for (size_t i= 0; i < elements; i++, keyuse++)
{
if (!keyuse->table)
break;
@@ -15505,7 +15504,7 @@ COND *Item_cond_and::build_equal_items(THD *thd,
if (!cond_args->elements &&
!cond_equal.current_level.elements &&
!eq_list.elements)
- return (Item*) &Item_true;
+ return (Item*) Item_true;
List_iterator_fast<Item_equal> it(cond_equal.current_level);
while ((item_equal= it++))
@@ -15612,7 +15611,7 @@ COND *Item_func_eq::build_equal_items(THD *thd,
Item_equal *item_equal;
int n= cond_equal.current_level.elements + eq_list.elements;
if (n == 0)
- return (Item*) &Item_true;
+ return (Item*) Item_true;
else if (n == 1)
{
if ((item_equal= cond_equal.current_level.pop()))
@@ -16016,7 +16015,7 @@ Item *eliminate_item_equal(THD *thd, COND *cond, COND_EQUAL *upper_levels,
List<Item> eq_list;
Item_func_eq *eq_item= 0;
if (((Item *) item_equal)->const_item() && !item_equal->val_int())
- return (Item*) &Item_false;
+ return (Item*) Item_false;
Item *item_const= item_equal->get_const();
Item_equal_fields_iterator it(*item_equal);
Item *head;
@@ -16161,7 +16160,7 @@ Item *eliminate_item_equal(THD *thd, COND *cond, COND_EQUAL *upper_levels,
switch (eq_list.elements)
{
case 0:
- res= cond ? cond : (Item*) &Item_true;
+ res= cond ? cond : (Item*) Item_true;
break;
case 1:
if (!cond || cond->is_bool_literal())
@@ -16414,9 +16413,9 @@ static void update_const_equal_items(THD *thd, COND *cond, JOIN_TAB *tab,
Item *item;
while ((item= li++))
update_const_equal_items(thd, item, tab,
- (((Item_cond*) cond)->top_level() &&
- ((Item_cond*) cond)->functype() ==
- Item_func::COND_AND_FUNC));
+ cond->is_top_level_item() &&
+ ((Item_cond*) cond)->functype() ==
+ Item_func::COND_AND_FUNC);
}
else if (cond->type() == Item::FUNC_ITEM &&
((Item_func*) cond)->functype() == Item_func::MULT_EQUAL_FUNC)
@@ -17999,7 +17998,7 @@ Item_func_isnull::remove_eq_conds(THD *thd, Item::cond_result *cond_value,
*/
- Item *item0= (Item*) &Item_false;
+ Item *item0= (Item*) Item_false;
Item *eq_cond= new(thd->mem_root) Item_func_eq(thd, args[0], item0);
if (!eq_cond)
return this;
@@ -18566,20 +18565,19 @@ setup_tmp_table_column_bitmaps(TABLE *table, uchar *bitmaps, uint field_count)
DBUG_ASSERT(table->s->virtual_fields == 0);
- my_bitmap_init(&table->def_read_set, (my_bitmap_map*) bitmaps, field_count,
- FALSE);
+ my_bitmap_init(&table->def_read_set, (my_bitmap_map*) bitmaps, field_count);
bitmaps+= bitmap_size;
my_bitmap_init(&table->tmp_set,
- (my_bitmap_map*) bitmaps, field_count, FALSE);
+ (my_bitmap_map*) bitmaps, field_count);
bitmaps+= bitmap_size;
my_bitmap_init(&table->eq_join_set,
- (my_bitmap_map*) bitmaps, field_count, FALSE);
+ (my_bitmap_map*) bitmaps, field_count);
bitmaps+= bitmap_size;
my_bitmap_init(&table->cond_set,
- (my_bitmap_map*) bitmaps, field_count, FALSE);
+ (my_bitmap_map*) bitmaps, field_count);
bitmaps+= bitmap_size;
my_bitmap_init(&table->has_value_set,
- (my_bitmap_map*) bitmaps, field_count, FALSE);
+ (my_bitmap_map*) bitmaps, field_count);
/* write_set and all_set are copies of read_set */
table->def_write_set= table->def_read_set;
table->s->all_set= table->def_read_set;
@@ -18702,7 +18700,7 @@ TABLE *Create_tmp_table::start(THD *thd,
(ulong) m_rows_limit, MY_TEST(m_group)));
if (use_temp_pool && !(test_flags & TEST_KEEP_TMP_TABLES))
- m_temp_pool_slot = bitmap_lock_set_next(&temp_pool);
+ m_temp_pool_slot = temp_pool_set_next();
if (m_temp_pool_slot != MY_BIT_NONE) // we got a slot
sprintf(path, "%s-%s-%lx-%i", tmp_file_prefix, param->tmp_name,
@@ -19614,7 +19612,7 @@ void Create_tmp_table::cleanup_on_failure(THD *thd, TABLE *table)
if (table)
free_tmp_table(thd, table);
if (m_temp_pool_slot != MY_BIT_NONE)
- bitmap_lock_clear_bit(&temp_pool, m_temp_pool_slot);
+ temp_pool_clear_bit(m_temp_pool_slot);
}
@@ -20379,7 +20377,7 @@ free_tmp_table(THD *thd, TABLE *entry)
(*ptr)->free();
if (entry->temp_pool_slot != MY_BIT_NONE)
- bitmap_lock_clear_bit(&temp_pool, entry->temp_pool_slot);
+ temp_pool_clear_bit(entry->temp_pool_slot);
plugin_unlock(0, entry->s->db_plugin);
entry->alias.free();
@@ -21061,7 +21059,7 @@ sub_select(JOIN *join,JOIN_TAB *join_tab,bool end_of_records)
if (join_tab->on_precond && !join_tab->on_precond->val_int())
rc= NESTED_LOOP_NO_MORE_ROWS;
}
- join->thd->get_stmt_da()->reset_current_row_for_warning();
+ join->thd->get_stmt_da()->reset_current_row_for_warning(1);
if (rc != NESTED_LOOP_NO_MORE_ROWS &&
(rc= join_tab_execution_startup(join_tab)) < 0)
@@ -28574,7 +28572,7 @@ JOIN::reoptimize(Item *added_where, table_map join_tables,
{
DYNAMIC_ARRAY added_keyuse;
SARGABLE_PARAM *sargables= 0; /* Used only as a dummy parameter. */
- uint org_keyuse_elements;
+ size_t org_keyuse_elements;
/* Re-run the REF optimizer to take into account the new conditions. */
if (update_ref_and_keys(thd, &added_keyuse, join_tab, table_count, added_where,
@@ -28596,7 +28594,7 @@ JOIN::reoptimize(Item *added_where, table_map join_tables,
reset_query_plan();
if (!keyuse.buffer &&
- my_init_dynamic_array(thd->mem_root->m_psi_key, &keyuse, sizeof(KEYUSE),
+ my_init_dynamic_array(thd->mem_root->psi_key, &keyuse, sizeof(KEYUSE),
20, 64, MYF(MY_THREAD_SPECIFIC)))
{
delete_dynamic(&added_keyuse);
@@ -29739,7 +29737,7 @@ void JOIN::make_notnull_conds_for_range_scans()
Found a IS NULL conjunctive predicate for a null-rejected field
in the WHERE clause
*/
- conds= (Item*) &Item_false;
+ conds= (Item*) Item_false;
cond_equal= 0;
impossible_where= true;
DBUG_VOID_RETURN;
@@ -29762,7 +29760,7 @@ void JOIN::make_notnull_conds_for_range_scans()
Found a IS NULL conjunctive predicate for a null-rejected field
of the inner table of an outer join with ON expression tbl->on_expr
*/
- tbl->on_expr= (Item*) &Item_false;
+ tbl->on_expr= (Item*) Item_false;
}
}
}
@@ -29913,7 +29911,7 @@ void build_notnull_conds_for_inner_nest_of_outer_join(JOIN *join,
if (used_tables &&
build_notnull_conds_for_range_scans(join, nest_tbl->on_expr, used_tables))
{
- nest_tbl->on_expr= (Item*) &Item_false;
+ nest_tbl->on_expr= (Item*) Item_false;
}
li.rewind();
@@ -29927,7 +29925,7 @@ void build_notnull_conds_for_inner_nest_of_outer_join(JOIN *join,
}
else if (build_notnull_conds_for_range_scans(join, tbl->on_expr,
tbl->table->map))
- tbl->on_expr= (Item*) &Item_false;
+ tbl->on_expr= (Item*) Item_false;
}
}
}