summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2014-02-14 14:09:29 +0100
committerSergei Golubchik <sergii@pisem.net>2014-02-14 14:09:29 +0100
commitfb27ce22f77705d394beb6acd7aa4be2ff008890 (patch)
treecf1288c289055405cf14f2b9ee408a90948e95ab /sql
parente2a99f1863a7a4d5d6d22c9f39de3b255c959f98 (diff)
parent5a21dc7df1024c13c212f687c5ebc40d9cb74c5b (diff)
downloadmariadb-git-fb27ce22f77705d394beb6acd7aa4be2ff008890.tar.gz
5.3 merge
Diffstat (limited to 'sql')
-rw-r--r--sql/item.cc31
-rw-r--r--sql/item_subselect.cc9
-rw-r--r--sql/item_subselect.h1
-rw-r--r--sql/scheduler.cc1
-rw-r--r--sql/sql_select.cc8
-rw-r--r--sql/sql_union.cc3
6 files changed, 27 insertions, 26 deletions
diff --git a/sql/item.cc b/sql/item.cc
index 2bf4ecd230c..5e4c4b03c16 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -1677,17 +1677,28 @@ bool Item_name_const::is_null()
Item_name_const::Item_name_const(Item *name_arg, Item *val):
value_item(val), name_item(name_arg)
{
- if (!(valid_args= name_item->basic_const_item() &&
- (value_item->basic_const_item() ||
- ((value_item->type() == FUNC_ITEM) &&
- ((((Item_func *) value_item)->functype() ==
- Item_func::COLLATE_FUNC) ||
- ((((Item_func *) value_item)->functype() ==
- Item_func::NEG_FUNC) &&
- (((Item_func *) value_item)->key_item()->type() !=
- FUNC_ITEM)))))))
- my_error(ER_WRONG_ARGUMENTS, MYF(0), "NAME_CONST");
Item::maybe_null= TRUE;
+ valid_args= true;
+ if (!name_item->basic_const_item())
+ goto err;
+
+ if (value_item->basic_const_item())
+ return; // ok
+
+ if (value_item->type() == FUNC_ITEM)
+ {
+ Item_func *value_func= (Item_func *) value_item;
+ if (value_func->functype() != Item_func::COLLATE_FUNC &&
+ value_func->functype() != Item_func::NEG_FUNC)
+ goto err;
+
+ if (value_func->key_item()->basic_const_item())
+ return; // ok
+ }
+
+err:
+ valid_args= false;
+ my_error(ER_WRONG_ARGUMENTS, MYF(0), "NAME_CONST");
}
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index be3879758a3..65ce50c1e3c 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -2883,7 +2883,7 @@ subselect_single_select_engine(THD *thd_arg, st_select_lex *select,
select_result_interceptor *result_arg,
Item_subselect *item_arg)
:subselect_engine(thd_arg, item_arg, result_arg),
- prepared(0), executed(0), optimize_error(0),
+ prepared(0), executed(0),
select_lex(select), join(0)
{
select_lex->master_unit()->item= item_arg;
@@ -2897,7 +2897,7 @@ int subselect_single_select_engine::get_identifier()
void subselect_single_select_engine::cleanup()
{
DBUG_ENTER("subselect_single_select_engine::cleanup");
- prepared= executed= optimize_error= 0;
+ prepared= executed= 0;
join= 0;
result->cleanup();
select_lex->uncacheable&= ~UNCACHEABLE_DEPENDENT_INJECTED;
@@ -3131,9 +3131,6 @@ int subselect_single_select_engine::exec()
{
DBUG_ENTER("subselect_single_select_engine::exec");
- if (optimize_error)
- DBUG_RETURN(1);
-
char const *save_where= thd->where;
SELECT_LEX *save_select= thd->lex->current_select;
thd->lex->current_select= select_lex;
@@ -3146,7 +3143,7 @@ int subselect_single_select_engine::exec()
if (join->optimize())
{
thd->where= save_where;
- executed= optimize_error= 1;
+ executed= 1;
thd->lex->current_select= save_select;
DBUG_RETURN(join->error ? join->error : 1);
}
diff --git a/sql/item_subselect.h b/sql/item_subselect.h
index 25852b55d98..592e7711a10 100644
--- a/sql/item_subselect.h
+++ b/sql/item_subselect.h
@@ -780,7 +780,6 @@ class subselect_single_select_engine: public subselect_engine
{
bool prepared; /* simple subselect is prepared */
bool executed; /* simple subselect is executed */
- bool optimize_error; /* simple subselect optimization failed */
st_select_lex *select_lex; /* corresponding select_lex */
JOIN * join; /* corresponding JOIN structure */
public:
diff --git a/sql/scheduler.cc b/sql/scheduler.cc
index 54653557b16..06e8ffb2b5e 100644
--- a/sql/scheduler.cc
+++ b/sql/scheduler.cc
@@ -129,7 +129,6 @@ void one_thread_scheduler(scheduler_functions *func)
{
scheduler_init();
func->max_threads= 1;
- //max_connections= 1;
func->max_connections= &max_connections;
func->connection_count= &connection_count;
#ifndef EMBEDDED_LIBRARY
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index a773eac1a32..84ccd51004e 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -3214,13 +3214,7 @@ make_join_statistics(JOIN *join, List<TABLE_LIST> &tables_list,
#endif
DBUG_EXECUTE_IF("bug11747970_raise_error",
- {
- if (!error)
- {
- my_error(ER_UNKNOWN_ERROR, MYF(0));
- goto error;
- }
- });
+ { join->thd->killed= KILL_QUERY_HARD; });
if (error)
{
table->file->print_error(error, MYF(0));
diff --git a/sql/sql_union.cc b/sql/sql_union.cc
index 82fe7f2936a..1d4ceb6245d 100644
--- a/sql/sql_union.cc
+++ b/sql/sql_union.cc
@@ -639,7 +639,8 @@ bool st_select_lex_unit::exec()
if (!(uncacheable & ~UNCACHEABLE_EXPLAIN) && item)
item->make_const();
- saved_error= optimize();
+ if ((saved_error= optimize()))
+ DBUG_RETURN(saved_error);
if (uncacheable || !item || !item->assigned() || describe)
{