summaryrefslogtreecommitdiff
path: root/sql/sql_update.cc
diff options
context:
space:
mode:
authorunknown <evgen@moonbone.local>2005-11-01 19:47:53 +0300
committerunknown <evgen@moonbone.local>2005-11-01 19:47:53 +0300
commit70536ba1b5b4c8e81f71b714112b42ff3fcc3f5e (patch)
tree6c1605103b3513ebad088e2997385997cd4d354f /sql/sql_update.cc
parentee380a077782f87d80aae7a8c9c9ead51dfd8e7b (diff)
parent03ed0d1d244de2e97c1ca5749f1677d1dbb07f95 (diff)
downloadmariadb-git-70536ba1b5b4c8e81f71b714112b42ff3fcc3f5e.tar.gz
Manually merged
client/mysqltest.c: Auto merged myisam/mi_check.c: Auto merged mysql-test/r/update.result: Auto merged mysql-test/t/update.test: Auto merged sql/item_timefunc.h: Auto merged sql/spatial.cc: Auto merged sql/sql_select.h: Auto merged BitKeeper/deleted/.del-acinclude.m4~f4ab416bac5003: Auto merged
Diffstat (limited to 'sql/sql_update.cc')
-rw-r--r--sql/sql_update.cc15
1 files changed, 12 insertions, 3 deletions
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index f83bd24f5d3..10debc9427d 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -132,7 +132,7 @@ int mysql_update(THD *thd,
ha_rows updated, found;
key_map old_used_keys;
TABLE *table;
- SQL_SELECT *select;
+ SQL_SELECT *select= 0;
READ_RECORD info;
SELECT_LEX *select_lex= &thd->lex->select_lex;
bool need_reopen;
@@ -228,11 +228,20 @@ int mysql_update(THD *thd,
DBUG_RETURN(1); /* purecov: inspected */
}
+ if (conds)
+ {
+ Item::cond_result cond_value;
+ conds= remove_eq_conds(thd, conds, &cond_value);
+ if (cond_value == Item::COND_FALSE)
+ limit= 0; // Impossible WHERE
+ }
// Don't count on usage of 'only index' when calculating which key to use
table->used_keys.clear_all();
select= make_select(table, 0, 0, conds, 0, &error);
- if (error ||
- (select && select->check_quick(thd, safe_update, limit)) || !limit)
+ if (limit)
+ select=make_select(table,0,0,conds,&error);
+ if (error || !limit ||
+ (select && select->check_quick(thd, safe_update, limit)))
{
delete select;
free_underlaid_joins(thd, select_lex);