summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <igor@olga.mysql.com>2007-01-25 21:01:28 -0800
committerunknown <igor@olga.mysql.com>2007-01-25 21:01:28 -0800
commit483a41bbb7ef9c5b5f545e3fc9b70e430fab1287 (patch)
tree1fa0a5171e177f947dcf3cdf53635526be06a19d /sql
parent24903ed56ca2cceb3b9cb9f690ab47cc95e072be (diff)
parentda561a802caff95d755b8d2061c27c248f22e3cd (diff)
downloadmariadb-git-483a41bbb7ef9c5b5f545e3fc9b70e430fab1287.tar.gz
Merge olga.mysql.com:/home/igor/dev-opt/mysql-4.1-opt-bug24653
into olga.mysql.com:/home/igor/dev-opt/mysql-5.0-opt-bug24653 sql/item.cc: Auto merged sql/item.h: Auto merged sql/item_cmpfunc.cc: Auto merged sql/item_func.cc: Auto merged sql/sql_select.cc: Auto merged mysql-test/r/subselect.result: Manual merge mysql-test/t/subselect.test: Manual merge sql/filesort.cc: Manual merge sql/item_cmpfunc.h: Manual merge sql/item_subselect.cc: Manual merge
Diffstat (limited to 'sql')
-rw-r--r--sql/filesort.cc6
-rw-r--r--sql/item_subselect.cc4
-rw-r--r--sql/sql_select.cc21
3 files changed, 29 insertions, 2 deletions
diff --git a/sql/filesort.cc b/sql/filesort.cc
index 81600ce8a93..73f480aad02 100644
--- a/sql/filesort.cc
+++ b/sql/filesort.cc
@@ -428,7 +428,8 @@ static ha_rows find_all_keys(SORTPARAM *param, SQL_SELECT *select,
byte *ref_pos,*next_pos,ref_buff[MAX_REFLENGTH];
my_off_t record;
TABLE *sort_form;
- volatile THD::killed_state *killed= &current_thd->killed;
+ THD *thd= current_thd;
+ volatile THD::killed_state *killed= &thd->killed;
handler *file;
DBUG_ENTER("find_all_keys");
DBUG_PRINT("info",("using: %s",(select?select->quick?"ranges":"where":"every row")));
@@ -525,6 +526,9 @@ static ha_rows find_all_keys(SORTPARAM *param, SQL_SELECT *select,
}
else
file->unlock_row();
+ /* It does not make sense to read more keys in case of a fatal error */
+ if (thd->net.report_error)
+ DBUG_RETURN(HA_POS_ERROR);
}
if (quick_select)
{
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index e19815960a6..7a2d749524b 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -195,7 +195,9 @@ bool Item_subselect::exec()
{
int res;
- res= engine->exec();
+ if (thd->net.report_error)
+ /* Do not execute subselect in case of a fatal error */
+ return 1;
if (engine_changed)
{
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index dbfdb783c9a..c445c6f5312 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -855,6 +855,13 @@ JOIN::optimize()
{
ORDER *org_order= order;
order=remove_const(this, order,conds,1, &simple_order);
+ if (thd->net.report_error)
+ {
+ error= 1;
+ DBUG_PRINT("error",("Error from remove_const"));
+ DBUG_RETURN(1);
+ }
+
/*
If we are using ORDER BY NULL or ORDER BY const_expression,
return result in any order (even if we are using a GROUP BY)
@@ -962,6 +969,12 @@ JOIN::optimize()
group_list= remove_const(this, (old_group_list= group_list), conds,
rollup.state == ROLLUP::STATE_NONE,
&simple_group);
+ if (thd->net.report_error)
+ {
+ error= 1;
+ DBUG_PRINT("error",("Error from remove_const"));
+ DBUG_RETURN(1);
+ }
if (old_group_list && !group_list)
select_distinct= 0;
}
@@ -978,6 +991,12 @@ JOIN::optimize()
{
group_list= procedure->group= remove_const(this, procedure->group, conds,
1, &simple_group);
+ if (thd->net.report_error)
+ {
+ error= 1;
+ DBUG_PRINT("error",("Error from remove_const"));
+ DBUG_RETURN(1);
+ }
calc_group_buffer(this, group_list);
}
@@ -6415,6 +6434,8 @@ remove_const(JOIN *join,ORDER *first_order, COND *cond,
*simple_order=0; // Must do a temp table to sort
else if (!(order_tables & not_const_tables))
{
+ if (order->item[0]->with_subselect)
+ order->item[0]->val_str(&order->item[0]->str_value);
DBUG_PRINT("info",("removing: %s", order->item[0]->full_name()));
continue; // skip const item
}