mirror of
https://github.com/MariaDB/server.git
synced 2025-08-29 00:08:14 +03:00
INSERT ... ON DUPLICATE KEY UPDATE ...
This commit is contained in:
@@ -1969,14 +1969,21 @@ mysql_execute_command(THD *thd)
|
||||
case SQLCOM_REPLACE:
|
||||
case SQLCOM_INSERT:
|
||||
{
|
||||
my_bool update=(lex->value_list.elements ? UPDATE_ACL : 0);
|
||||
ulong privilege= (lex->duplicates == DUP_REPLACE ?
|
||||
INSERT_ACL | DELETE_ACL : INSERT_ACL);
|
||||
INSERT_ACL | DELETE_ACL : INSERT_ACL | update);
|
||||
if (check_access(thd,privilege,tables->db,&tables->grant.privilege))
|
||||
goto error; /* purecov: inspected */
|
||||
if (grant_option && check_grant(thd,privilege,tables))
|
||||
goto error;
|
||||
if (select_lex->item_list.elements != lex->value_list.elements)
|
||||
{
|
||||
send_error(thd,ER_WRONG_VALUE_COUNT);
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
res = mysql_insert(thd,tables,lex->field_list,lex->many_values,
|
||||
lex->duplicates);
|
||||
select_lex->item_list, lex->value_list,
|
||||
(update ? DUP_UPDATE : lex->duplicates));
|
||||
break;
|
||||
}
|
||||
case SQLCOM_REPLACE_SELECT:
|
||||
|
Reference in New Issue
Block a user