diff options
author | unknown <pem@mysql.comhem.se> | 2004-09-08 14:23:14 +0200 |
---|---|---|
committer | unknown <pem@mysql.comhem.se> | 2004-09-08 14:23:14 +0200 |
commit | c92b5349701ba68fa7ab97abf14933de8d6352fe (patch) | |
tree | bf5ec7b5d6fd4a091b16a9fb6c6ca68cc5d2c22b /sql/sql_yacc.yy | |
parent | 1bf3ce01c48f980c183a8b88afdc0440a26da36d (diff) | |
download | mariadb-git-c92b5349701ba68fa7ab97abf14933de8d6352fe.tar.gz |
Fixed BUG#5000: SPs can be created with no default database.
Easy to prevent crash, but the question was how to treat this case?
We ended up implementing the "global" SPs (i.e. with no associated
db), which were planned but left unresolved when SPs moved into dbs.
So now things like "call .p()" work too.
mysql-test/r/sp-error.result:
New test case for BUG#5000, and "global" SPs in general.
mysql-test/t/sp-error.test:
New test case for BUG#5000, and "global" SPs in general.
sql/sp.cc:
Prevent crash when the new db is null.
sql/sp_head.cc:
Don't set the db part of the name to thd->db, we have already set it correctly
in the provided name struct.
Also, don't attempt to change "no-db" when executing an SP.
sql/sql_yacc.yy:
Added support for the "global SP" syntax, e.g ".p()".
Diffstat (limited to 'sql/sql_yacc.yy')
-rw-r--r-- | sql/sql_yacc.yy | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index ba3a36f2c34..17cc3b7d12c 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -1207,7 +1207,12 @@ create: ; sp_name: - IDENT_sys '.' IDENT_sys + '.' IDENT_sys + { + $$= new sp_name($2); + $$->init_qname(YYTHD); + } + | IDENT_sys '.' IDENT_sys { $$= new sp_name($1, $3); $$->init_qname(YYTHD); @@ -4312,6 +4317,18 @@ simple_expr: { $$= new Item_func_round($3,$5,1); } | TRUE_SYM { $$= new Item_int((char*) "TRUE",1,1); } + | '.' ident '(' udf_expr_list ')' + { + LEX *lex= Lex; + sp_name *name= new sp_name($2); + + name->init_qname(YYTHD); + sp_add_fun_to_lex(Lex, name); + if ($4) + $$= new Item_func_sp(name, *$4); + else + $$= new Item_func_sp(name); + } | ident '.' ident '(' udf_expr_list ')' { LEX *lex= Lex; |