summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2019-03-26 17:43:59 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2019-03-26 17:43:59 +0200
commit0bc42602266815b81fe86b08c2228912c1a95340 (patch)
tree7379577fac279387ec64d9ec0d752db11b0e425c /sql
parent7225bef7275da77faab316b863da0f4f5bf24a8f (diff)
parent2d592f757cd624fe964ac39d05b6bdd985a827e2 (diff)
downloadmariadb-git-0bc42602266815b81fe86b08c2228912c1a95340.tar.gz
Merge 10.3 into 10.4
Diffstat (limited to 'sql')
-rw-r--r--sql/item.h7
-rw-r--r--sql/item_cmpfunc.cc10
-rw-r--r--sql/item_func.cc12
-rw-r--r--sql/item_func.h1
-rw-r--r--sql/sql_parse.cc6
-rw-r--r--sql/sql_select.cc4
6 files changed, 18 insertions, 22 deletions
diff --git a/sql/item.h b/sql/item.h
index 6fc04fdde14..7d1f14d31cf 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -1449,6 +1449,13 @@ public:
}
virtual String *val_raw(String*) { return 0; }
+ bool eval_const_cond()
+ {
+ DBUG_ASSERT(const_item());
+ DBUG_ASSERT(!is_expensive());
+ return val_bool();
+ }
+
/*
save_val() is method of val_* family which stores value in the given
field.
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 86725de8ae7..dcd48a679d7 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2013, Oracle and/or its affiliates.
- Copyright (c) 2009, 2016, MariaDB
+ Copyright (c) 2009, 2019, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -4770,7 +4770,7 @@ Item_cond::fix_fields(THD *thd, Item **ref)
List_iterator<Item> li(list);
Item *item;
uchar buff[sizeof(char*)]; // Max local vars in function
- longlong is_and_cond= functype() == Item_func::COND_AND_FUNC;
+ bool is_and_cond= functype() == Item_func::COND_AND_FUNC;
not_null_tables_cache= 0;
used_tables_and_const_cache_init();
@@ -4834,7 +4834,7 @@ Item_cond::fix_fields(THD *thd, Item **ref)
if (item->const_item() && !item->with_param &&
!item->is_expensive() && !cond_has_datetime_is_null(item))
{
- if (item->val_int() == is_and_cond && top_level())
+ if (item->eval_const_cond() == is_and_cond && top_level())
{
/*
a. This is "... AND true_cond AND ..."
@@ -4886,7 +4886,7 @@ bool
Item_cond::eval_not_null_tables(void *opt_arg)
{
Item *item;
- longlong is_and_cond= functype() == Item_func::COND_AND_FUNC;
+ bool is_and_cond= functype() == Item_func::COND_AND_FUNC;
List_iterator<Item> li(list);
not_null_tables_cache= (table_map) 0;
and_tables_cache= ~(table_map) 0;
@@ -4896,7 +4896,7 @@ Item_cond::eval_not_null_tables(void *opt_arg)
if (item->const_item() && !item->with_param &&
!item->is_expensive() && !cond_has_datetime_is_null(item))
{
- if (item->val_int() == is_and_cond && top_level())
+ if (item->eval_const_cond() == is_and_cond && top_level())
{
/*
a. This is "... AND true_cond AND ..."
diff --git a/sql/item_func.cc b/sql/item_func.cc
index a86bc7fe7a8..704c4897f01 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -71,18 +71,6 @@ bool check_reserved_words(const LEX_CSTRING *name)
/**
- @return
- TRUE if item is a constant
-*/
-
-bool
-eval_const_cond(COND *cond)
-{
- return ((Item_func*) cond)->val_int() ? TRUE : FALSE;
-}
-
-
-/**
Test if the sum of arguments overflows the ulonglong range.
*/
static inline bool test_if_sum_overflows_ull(ulonglong arg1, ulonglong arg2)
diff --git a/sql/item_func.h b/sql/item_func.h
index 3185df91dca..7447d57722a 100644
--- a/sql/item_func.h
+++ b/sql/item_func.h
@@ -3445,7 +3445,6 @@ Item *get_system_var(THD *thd, enum_var_type var_type,
extern bool check_reserved_words(const LEX_CSTRING *name);
double my_double_round(double value, longlong dec, bool dec_unsigned,
bool truncate);
-bool eval_const_cond(COND *cond);
extern bool volatile mqh_used;
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 87ac04ea0ba..6e7b1d07073 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2017, Oracle and/or its affiliates.
- Copyright (c) 2008, 2019, MariaDB Corporation.
+ Copyright (c) 2008, 2019, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -3864,8 +3864,10 @@ mysql_execute_command(THD *thd)
else
{
WSREP_SYNC_WAIT(thd, WSREP_SYNC_WAIT_BEFORE_SHOW);
+# ifdef ENABLED_PROFILING
if (lex->sql_command == SQLCOM_SHOW_PROFILE)
thd->profiling.discard_current_query();
+# endif
}
#endif /* WITH_WSREP */
@@ -6725,7 +6727,7 @@ static bool check_rename_table(THD *thd, TABLE_LIST *first_table,
0, 0))
return 1;
- /* check if these are refering to temporary tables */
+ /* check if these are referring to temporary tables */
table->table= find_temporary_table_for_rename(thd, first_table, table);
table->next_local->table= table->table;
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index c8974721d09..e8b092b1b23 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -17066,7 +17066,7 @@ Item::remove_eq_conds(THD *thd, Item::cond_result *cond_value, bool top_level_ar
{
if (const_item() && !is_expensive())
{
- *cond_value= eval_const_cond(this) ? Item::COND_TRUE : Item::COND_FALSE;
+ *cond_value= eval_const_cond() ? Item::COND_TRUE : Item::COND_FALSE;
return (COND*) 0;
}
*cond_value= Item::COND_OK;
@@ -17080,7 +17080,7 @@ Item_bool_func2::remove_eq_conds(THD *thd, Item::cond_result *cond_value,
{
if (const_item() && !is_expensive())
{
- *cond_value= eval_const_cond(this) ? Item::COND_TRUE : Item::COND_FALSE;
+ *cond_value= eval_const_cond() ? Item::COND_TRUE : Item::COND_FALSE;
return (COND*) 0;
}
if ((*cond_value= eq_cmp_result()) != Item::COND_OK)