diff options
author | dlenev@mysql.com <> | 2004-10-20 17:02:15 +0400 |
---|---|---|
committer | dlenev@mysql.com <> | 2004-10-20 17:02:15 +0400 |
commit | a10ce662b4bcad9fdc498ad844e834e9d7395e46 (patch) | |
tree | d205110e5c685cbe75039f3cf7cb8a950c01d368 /sql | |
parent | 0130f4669a67cb64dc22dad6a70dbdf7838bd3fb (diff) | |
parent | 75d816627c6e900519ee89df522a584f4d5afb91 (diff) | |
download | mariadb-git-a10ce662b4bcad9fdc498ad844e834e9d7395e46.tar.gz |
Merge bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/home/dlenev/src/mysql-4.1-secfix
Diffstat (limited to 'sql')
-rw-r--r-- | sql/mysql_priv.h | 2 | ||||
-rw-r--r-- | sql/sql_parse.cc | 12 | ||||
-rw-r--r-- | sql/sql_prepare.cc | 6 | ||||
-rw-r--r-- | sql/sql_yacc.yy | 12 |
4 files changed, 17 insertions, 15 deletions
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index e94d436b135..5770f23638e 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -374,7 +374,7 @@ int multi_delete_precheck(THD *thd, TABLE_LIST *tables, uint *table_count); int insert_select_precheck(THD *thd, TABLE_LIST *tables); int update_precheck(THD *thd, TABLE_LIST *tables); int delete_precheck(THD *thd, TABLE_LIST *tables); -int insert_precheck(THD *thd, TABLE_LIST *tables, bool update); +int insert_precheck(THD *thd, TABLE_LIST *tables); int create_table_precheck(THD *thd, TABLE_LIST *tables, TABLE_LIST *create_table); Item *negate_expression(THD *thd, Item *expr); diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 8df0dd681db..daa0bc1e063 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -2682,12 +2682,11 @@ unsent_create_error: case SQLCOM_REPLACE: case SQLCOM_INSERT: { - my_bool update= (lex->value_list.elements ? UPDATE_ACL : 0); - if ((res= insert_precheck(thd, tables, update))) + if ((res= insert_precheck(thd, tables))) break; res = mysql_insert(thd,tables,lex->field_list,lex->many_values, select_lex->item_list, lex->value_list, - (update ? DUP_UPDATE : lex->duplicates)); + lex->duplicates); if (thd->net.report_error) res= -1; break; @@ -5366,13 +5365,14 @@ int delete_precheck(THD *thd, TABLE_LIST *tables) -1 error (message is not sent to user) */ -int insert_precheck(THD *thd, TABLE_LIST *tables, bool update) +int insert_precheck(THD *thd, TABLE_LIST *tables) { LEX *lex= thd->lex; DBUG_ENTER("insert_precheck"); - ulong privilege= (lex->duplicates == DUP_REPLACE ? - INSERT_ACL | DELETE_ACL : INSERT_ACL | update); + ulong privilege= INSERT_ACL | + (lex->duplicates == DUP_REPLACE ? DELETE_ACL : 0) | + (lex->duplicates == DUP_UPDATE ? UPDATE_ACL : 0); if (check_one_table_access(thd, privilege, tables)) DBUG_RETURN(1); diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index 1bd359ec9ec..239ff13f261 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -895,10 +895,9 @@ static int mysql_test_insert(Prepared_statement *stmt, int res= -1; TABLE_LIST *insert_table_list= (TABLE_LIST*) lex->select_lex.table_list.first; - my_bool update= (lex->value_list.elements ? UPDATE_ACL : 0); DBUG_ENTER("mysql_test_insert"); - if ((res= insert_precheck(thd, table_list, update))) + if ((res= insert_precheck(thd, table_list))) DBUG_RETURN(res); /* @@ -1388,8 +1387,7 @@ static int send_prepare_results(Prepared_statement *stmt, bool text_protocol) res= mysql_test_insert(stmt, tables, lex->field_list, lex->many_values, select_lex->item_list, lex->value_list, - (lex->value_list.elements ? - DUP_UPDATE : lex->duplicates)); + lex->duplicates); break; case SQLCOM_UPDATE: diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index d9a21baf84e..426f6d4d057 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -4136,14 +4136,18 @@ expr_or_default: opt_insert_update: /* empty */ | ON DUPLICATE_SYM - { /* for simplisity, let's forget about - INSERT ... SELECT ... UPDATE - for a moment */ - if (Lex->sql_command != SQLCOM_INSERT) + { + LEX *lex= Lex; + /* + For simplicity, let's forget about INSERT ... SELECT ... UPDATE + for a moment. + */ + if (lex->sql_command != SQLCOM_INSERT) { yyerror(ER(ER_SYNTAX_ERROR)); YYABORT; } + lex->duplicates= DUP_UPDATE; } KEY_SYM UPDATE_SYM update_list ; |