1
0
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:
unknown
2002-12-02 20:38:00 +01:00
parent 0859f671bd
commit 0029b4e794
7 changed files with 130 additions and 25 deletions

View File

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