summaryrefslogtreecommitdiff
path: root/sql/sql_update.cc
diff options
context:
space:
mode:
authorunknown <Sinisa@sinisa.nasamreza.org>2002-11-15 22:01:28 +0200
committerunknown <Sinisa@sinisa.nasamreza.org>2002-11-15 22:01:28 +0200
commitd798928d0e248b8d7c0bc38f38388f7854d85429 (patch)
tree7795dea67805d7e81e9370e557305a2405330864 /sql/sql_update.cc
parent95ff7f77dd8dbbe804139e53c5fa521dfd13fa36 (diff)
downloadmariadb-git-d798928d0e248b8d7c0bc38f38388f7854d85429.tar.gz
A fix for safe updates
Diffstat (limited to 'sql/sql_update.cc')
-rw-r--r--sql/sql_update.cc8
1 files changed, 3 insertions, 5 deletions
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index 0b440eb3060..f2d2b71bd5b 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -53,7 +53,7 @@ int mysql_update(THD *thd,
enum enum_duplicates handle_duplicates,
thr_lock_type lock_type)
{
- bool using_limit=limit != HA_POS_ERROR;
+ bool using_limit=limit != HA_POS_ERROR, safe_update= thd->options & OPTION_SAFE_UPDATES;
bool used_key_is_modified, transactional_table, log_delayed;
int error=0;
uint save_time_stamp, used_index, want_privilege;
@@ -117,9 +117,7 @@ int mysql_update(THD *thd,
table->used_keys=0;
select=make_select(table,0,0,conds,&error);
if (error ||
- (select && select->check_quick(test(thd->options & OPTION_SAFE_UPDATES),
- limit)) ||
- !limit)
+ (select && select->check_quick(safe_update, limit)) || !limit)
{
delete select;
table->time_stamp=save_time_stamp; // Restore timestamp pointer
@@ -134,7 +132,7 @@ int mysql_update(THD *thd,
if (!table->quick_keys)
{
thd->lex.select_lex.options|=QUERY_NO_INDEX_USED;
- if ((thd->options & OPTION_SAFE_UPDATES) && limit == HA_POS_ERROR)
+ if (safe_update && !using_limit)
{
delete select;
table->time_stamp=save_time_stamp;