summaryrefslogtreecommitdiff
path: root/sql/sql_update.cc
diff options
context:
space:
mode:
authorunknown <antony@ltantony.rdg.cyberkinetica.homeunix.net>2004-12-18 15:12:10 +0000
committerunknown <antony@ltantony.rdg.cyberkinetica.homeunix.net>2004-12-18 15:12:10 +0000
commit02453262bcecf06408382a4cffec162cc0d4d674 (patch)
treec553786f19f99a3ccca5eda7e06d7cf8a2773621 /sql/sql_update.cc
parent4e8e1ef30d393920da36626d6eb272ceca4b5578 (diff)
parent047f7904715c1dcd9fc2ada7052e0237e6e97861 (diff)
downloadmariadb-git-02453262bcecf06408382a4cffec162cc0d4d674.tar.gz
Merge Bug#7391 from 4.0
mysql-test/r/update.result: Auto merged mysql-test/t/update.test: Auto merged sql/sql_select.cc: Auto merged mysql-test/mysql-test-run.sh: Merge from 4.0
Diffstat (limited to 'sql/sql_update.cc')
-rw-r--r--sql/sql_update.cc20
1 files changed, 18 insertions, 2 deletions
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index 6fc68142a12..2b27cff13e2 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -553,7 +553,9 @@ int mysql_multi_update(THD *thd,
*/
for (tl= update_list; tl; tl= tl->next)
{
+ TABLE_LIST *save= tl->next;
TABLE *table= tl->table;
+ uint wants;
/* if table will be updated then check that it is unique */
if (table->map & update_tables)
{
@@ -571,17 +573,31 @@ int mysql_multi_update(THD *thd,
DBUG_PRINT("info",("setting table `%s` for update", tl->alias));
tl->lock_type= thd->lex->multi_lock_option;
tl->updating= 1;
+ wants= UPDATE_ACL;
}
else
{
DBUG_PRINT("info",("setting table `%s` for read-only", tl->alias));
tl->lock_type= TL_READ;
tl->updating= 0;
+ wants= SELECT_ACL;
}
+
if (tl->derived)
derived_tables|= table->map;
- else if (!using_lock_tables)
- tl->table->reginfo.lock_type= tl->lock_type;
+ else
+ {
+ tl->next= 0;
+ if (!using_lock_tables)
+ tl->table->reginfo.lock_type= tl->lock_type;
+ if (check_access(thd, wants, tl->db, &tl->grant.privilege, 0, 0) ||
+ (grant_option && check_grant(thd, wants, tl, 0, 0, 0)))
+ {
+ tl->next= save;
+ DBUG_RETURN(0);
+ }
+ tl->next= save;
+ }
}
if (thd->lex->derived_tables && (update_tables & derived_tables))