diff options
author | unknown <pem@mysql.comhem.se> | 2004-11-25 16:13:06 +0100 |
---|---|---|
committer | unknown <pem@mysql.comhem.se> | 2004-11-25 16:13:06 +0100 |
commit | ea75abc51300e62ddff4842ddc11d378861aa07b (patch) | |
tree | 68158d653cffb98543a506d97806bacfa5ddf4d3 /sql/sql_parse.cc | |
parent | a0f2ecf7fbb0194ed26a8b6dadd4fffa672c46bc (diff) | |
download | mariadb-git-ea75abc51300e62ddff4842ddc11d378861aa07b.tar.gz |
Fixed BUG#6807: Stored procedure crash if CREATE PROCEDURE ... KILL QUERY
...and for PURGE BEFORE too. (Don't fix_fields in the parser!)
mysql-test/r/sp-error.result:
New test case for BUG#6807
mysql-test/t/sp-error.test:
New test case for BUG#6807
sql/sql_lex.h:
Purge and kill query args not needed in lex. (Using value_list instead)
sql/sql_parse.cc:
Evaluate purge before and kill query args in mysql_execute_command
instead of in the parser. (Makes it work with stored procedures)
sql/sql_yacc.yy:
Don't evaluate (fix_fields) args in the parser for purge before and kill query.
(Doesn't work with stored procedures)
Diffstat (limited to 'sql/sql_parse.cc')
-rw-r--r-- | sql/sql_parse.cc | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index fce8d294456..50d413ade38 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -2327,10 +2327,24 @@ mysql_execute_command(THD *thd) } case SQLCOM_PURGE_BEFORE: { + Item *it; + if (check_global_access(thd, SUPER_ACL)) goto error; /* PURGE MASTER LOGS BEFORE 'data' */ - res = purge_master_logs_before_date(thd, lex->purge_time); + it= (Item *)lex->value_list.head(); + if (it->check_cols(1) || it->fix_fields(lex->thd, 0, &it)) + { + my_error(ER_WRONG_ARGUMENTS, MYF(0), "PURGE LOGS BEFORE"); + goto error; + } + it= new Item_func_unix_timestamp(it); + /* + it is OK only emulate fix_fieds, because we need only + value of constant + */ + it->quick_fix_field(); + res = purge_master_logs_before_date(thd, (ulong)it->val_int()); break; } #endif @@ -3505,8 +3519,18 @@ create_error: break; } case SQLCOM_KILL: - kill_one_thread(thd,lex->thread_id, lex->type & ONLY_KILL_QUERY); + { + Item *it= (Item *)lex->value_list.head(); + + if (it->fix_fields(lex->thd, 0, &it) || it->check_cols(1)) + { + my_message(ER_SET_CONSTANTS_ONLY, ER(ER_SET_CONSTANTS_ONLY), + MYF(0)); + goto error; + } + kill_one_thread(thd, (ulong)it->val_int(), lex->type & ONLY_KILL_QUERY); break; + } #ifndef NO_EMBEDDED_ACCESS_CHECKS case SQLCOM_SHOW_GRANTS: if ((thd->priv_user && |