1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Merge Bug#7391 from 4.0

This commit is contained in:
antony@ltantony.rdg.cyberkinetica.homeunix.net
2004-12-18 15:12:10 +00:00
5 changed files with 158 additions and 11 deletions

View File

@ -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))