2002-12-12 13:14:23 +01:00
|
|
|
/* -*- C++ -*- */
|
|
|
|
/* Copyright (C) 2002 MySQL AB
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
|
|
|
|
|
|
|
#ifndef _SP_H_
|
|
|
|
#define _SP_H_
|
|
|
|
|
Most of the groundwork for sprint task 729 (implement FUNCTIONs).
Expanded the mysql.proc table, reworked the find/create/drop functions
completely, added new functions for FUNCTIONs (lotta functions here :),
got rid of some unnecessary use of Item_strings while at it. Extended
the parser correspondingly, and fiddled around a bit to make SP FUNCTIONs
coexist with UDFs.
Can now CREATE and DROP FUNCTIONs. Invoking yet to come...
Docs/sp-implemented.txt:
Updated with info about CASCADE/RESTICT and METHOD, and some answers to questions.
include/mysqld_error.h:
New error message for misuse of RETURN.
mysql-test/install_test_db.sh:
Added enum field to mysql.proc to distinguish between FUNCTION and PROCEDURE.
mysql-test/r/sp.result:
New test for creating and dropping FUNCTIONS.
mysql-test/t/sp.test:
New test for creating and dropping FUNCTIONS.
scripts/mysql_install_db.sh:
Added enum field to mysql.proc to distinguish between FUNCTION and PROCEDURE.
sql/lex.h:
De-UDFed some symbol names, as they are now used for SPs as well.
Added RETURN_SYM.
sql/share/czech/errmsg.txt:
New error message for misuse of RETURN.
sql/share/danish/errmsg.txt:
New error message for misuse of RETURN.
sql/share/dutch/errmsg.txt:
New error message for misuse of RETURN.
sql/share/english/errmsg.txt:
New error message for misuse of RETURN.
sql/share/estonian/errmsg.txt:
New error message for misuse of RETURN.
sql/share/french/errmsg.txt:
New error message for misuse of RETURN.
sql/share/german/errmsg.txt:
New error message for misuse of RETURN.
sql/share/greek/errmsg.txt:
New error message for misuse of RETURN.
sql/share/hungarian/errmsg.txt:
New error message for misuse of RETURN.
sql/share/italian/errmsg.txt:
New error message for misuse of RETURN.
sql/share/japanese/errmsg.txt:
New error message for misuse of RETURN.
sql/share/korean/errmsg.txt:
New error message for misuse of RETURN.
sql/share/norwegian-ny/errmsg.txt:
New error message for misuse of RETURN.
sql/share/norwegian/errmsg.txt:
New error message for misuse of RETURN.
sql/share/polish/errmsg.txt:
New error message for misuse of RETURN.
sql/share/portuguese/errmsg.txt:
New error message for misuse of RETURN.
sql/share/romanian/errmsg.txt:
New error message for misuse of RETURN.
sql/share/russian/errmsg.txt:
New error message for misuse of RETURN.
sql/share/serbian/errmsg.txt:
New error message for misuse of RETURN.
sql/share/slovak/errmsg.txt:
New error message for misuse of RETURN.
sql/share/spanish/errmsg.txt:
New error message for misuse of RETURN.
sql/share/swedish/errmsg.txt:
New error message for misuse of RETURN.
sql/share/ukrainian/errmsg.txt:
New error message for misuse of RETURN.
sql/sp.cc:
Major rehack to accomodate FUNCTIONs, and to make it easier to add
future in-memory cache of prepared SPs.
sql/sp.h:
Major rehack to accomodate FUNCTIONs, and to make it easier to add
future in-memory cache of prepared SPs.
sql/sp_head.cc:
Now creates FUNCTIONs too. (And got rid of some unnecessary Item_string use.)
sql/sp_head.h:
Now creates FUNCTIONs too. (And got rid of some unnecessary Item_string use.)
sql/sql_lex.h:
New stored FUNCTION commands.
sql/sql_parse.cc:
Added FUNCTION support ("drop" merged with the old UDF code), and made some
additional changes for better error handling (following the sp.cc rehacking).
sql/sql_yacc.yy:
Some former UDF specific symbols renamed.
Added CREATE FUNCTION parsing.
DROP FUNCTION had to be partly merged with the old UDF code, because of the similar
syntax.
RETURN statement added, but still a no-op.
2003-02-21 17:37:05 +01:00
|
|
|
// Return codes from sp_create_* and sp_drop_*:
|
|
|
|
#define SP_OK 0
|
|
|
|
#define SP_KEY_NOT_FOUND -1
|
|
|
|
#define SP_OPEN_TABLE_FAILED -2
|
|
|
|
#define SP_WRITE_ROW_FAILED -3
|
|
|
|
#define SP_DELETE_ROW_FAILED -4
|
|
|
|
#define SP_GET_FIELD_FAILED -5
|
|
|
|
#define SP_PARSE_ERROR -6
|
|
|
|
|
2002-12-12 13:14:23 +01:00
|
|
|
sp_head *
|
Most of the groundwork for sprint task 729 (implement FUNCTIONs).
Expanded the mysql.proc table, reworked the find/create/drop functions
completely, added new functions for FUNCTIONs (lotta functions here :),
got rid of some unnecessary use of Item_strings while at it. Extended
the parser correspondingly, and fiddled around a bit to make SP FUNCTIONs
coexist with UDFs.
Can now CREATE and DROP FUNCTIONs. Invoking yet to come...
Docs/sp-implemented.txt:
Updated with info about CASCADE/RESTICT and METHOD, and some answers to questions.
include/mysqld_error.h:
New error message for misuse of RETURN.
mysql-test/install_test_db.sh:
Added enum field to mysql.proc to distinguish between FUNCTION and PROCEDURE.
mysql-test/r/sp.result:
New test for creating and dropping FUNCTIONS.
mysql-test/t/sp.test:
New test for creating and dropping FUNCTIONS.
scripts/mysql_install_db.sh:
Added enum field to mysql.proc to distinguish between FUNCTION and PROCEDURE.
sql/lex.h:
De-UDFed some symbol names, as they are now used for SPs as well.
Added RETURN_SYM.
sql/share/czech/errmsg.txt:
New error message for misuse of RETURN.
sql/share/danish/errmsg.txt:
New error message for misuse of RETURN.
sql/share/dutch/errmsg.txt:
New error message for misuse of RETURN.
sql/share/english/errmsg.txt:
New error message for misuse of RETURN.
sql/share/estonian/errmsg.txt:
New error message for misuse of RETURN.
sql/share/french/errmsg.txt:
New error message for misuse of RETURN.
sql/share/german/errmsg.txt:
New error message for misuse of RETURN.
sql/share/greek/errmsg.txt:
New error message for misuse of RETURN.
sql/share/hungarian/errmsg.txt:
New error message for misuse of RETURN.
sql/share/italian/errmsg.txt:
New error message for misuse of RETURN.
sql/share/japanese/errmsg.txt:
New error message for misuse of RETURN.
sql/share/korean/errmsg.txt:
New error message for misuse of RETURN.
sql/share/norwegian-ny/errmsg.txt:
New error message for misuse of RETURN.
sql/share/norwegian/errmsg.txt:
New error message for misuse of RETURN.
sql/share/polish/errmsg.txt:
New error message for misuse of RETURN.
sql/share/portuguese/errmsg.txt:
New error message for misuse of RETURN.
sql/share/romanian/errmsg.txt:
New error message for misuse of RETURN.
sql/share/russian/errmsg.txt:
New error message for misuse of RETURN.
sql/share/serbian/errmsg.txt:
New error message for misuse of RETURN.
sql/share/slovak/errmsg.txt:
New error message for misuse of RETURN.
sql/share/spanish/errmsg.txt:
New error message for misuse of RETURN.
sql/share/swedish/errmsg.txt:
New error message for misuse of RETURN.
sql/share/ukrainian/errmsg.txt:
New error message for misuse of RETURN.
sql/sp.cc:
Major rehack to accomodate FUNCTIONs, and to make it easier to add
future in-memory cache of prepared SPs.
sql/sp.h:
Major rehack to accomodate FUNCTIONs, and to make it easier to add
future in-memory cache of prepared SPs.
sql/sp_head.cc:
Now creates FUNCTIONs too. (And got rid of some unnecessary Item_string use.)
sql/sp_head.h:
Now creates FUNCTIONs too. (And got rid of some unnecessary Item_string use.)
sql/sql_lex.h:
New stored FUNCTION commands.
sql/sql_parse.cc:
Added FUNCTION support ("drop" merged with the old UDF code), and made some
additional changes for better error handling (following the sp.cc rehacking).
sql/sql_yacc.yy:
Some former UDF specific symbols renamed.
Added CREATE FUNCTION parsing.
DROP FUNCTION had to be partly merged with the old UDF code, because of the similar
syntax.
RETURN statement added, but still a no-op.
2003-02-21 17:37:05 +01:00
|
|
|
sp_find_procedure(THD *thd, LEX_STRING *name);
|
2002-12-12 13:14:23 +01:00
|
|
|
|
|
|
|
int
|
2003-05-06 18:09:20 +02:00
|
|
|
sp_create_procedure(THD *thd, char *name, uint namelen, char *def, uint deflen,
|
|
|
|
char *comment, uint commentlen, bool suid);
|
2002-12-12 13:14:23 +01:00
|
|
|
|
|
|
|
int
|
2003-02-04 17:40:18 +01:00
|
|
|
sp_drop_procedure(THD *thd, char *name, uint namelen);
|
|
|
|
|
Most of the groundwork for sprint task 729 (implement FUNCTIONs).
Expanded the mysql.proc table, reworked the find/create/drop functions
completely, added new functions for FUNCTIONs (lotta functions here :),
got rid of some unnecessary use of Item_strings while at it. Extended
the parser correspondingly, and fiddled around a bit to make SP FUNCTIONs
coexist with UDFs.
Can now CREATE and DROP FUNCTIONs. Invoking yet to come...
Docs/sp-implemented.txt:
Updated with info about CASCADE/RESTICT and METHOD, and some answers to questions.
include/mysqld_error.h:
New error message for misuse of RETURN.
mysql-test/install_test_db.sh:
Added enum field to mysql.proc to distinguish between FUNCTION and PROCEDURE.
mysql-test/r/sp.result:
New test for creating and dropping FUNCTIONS.
mysql-test/t/sp.test:
New test for creating and dropping FUNCTIONS.
scripts/mysql_install_db.sh:
Added enum field to mysql.proc to distinguish between FUNCTION and PROCEDURE.
sql/lex.h:
De-UDFed some symbol names, as they are now used for SPs as well.
Added RETURN_SYM.
sql/share/czech/errmsg.txt:
New error message for misuse of RETURN.
sql/share/danish/errmsg.txt:
New error message for misuse of RETURN.
sql/share/dutch/errmsg.txt:
New error message for misuse of RETURN.
sql/share/english/errmsg.txt:
New error message for misuse of RETURN.
sql/share/estonian/errmsg.txt:
New error message for misuse of RETURN.
sql/share/french/errmsg.txt:
New error message for misuse of RETURN.
sql/share/german/errmsg.txt:
New error message for misuse of RETURN.
sql/share/greek/errmsg.txt:
New error message for misuse of RETURN.
sql/share/hungarian/errmsg.txt:
New error message for misuse of RETURN.
sql/share/italian/errmsg.txt:
New error message for misuse of RETURN.
sql/share/japanese/errmsg.txt:
New error message for misuse of RETURN.
sql/share/korean/errmsg.txt:
New error message for misuse of RETURN.
sql/share/norwegian-ny/errmsg.txt:
New error message for misuse of RETURN.
sql/share/norwegian/errmsg.txt:
New error message for misuse of RETURN.
sql/share/polish/errmsg.txt:
New error message for misuse of RETURN.
sql/share/portuguese/errmsg.txt:
New error message for misuse of RETURN.
sql/share/romanian/errmsg.txt:
New error message for misuse of RETURN.
sql/share/russian/errmsg.txt:
New error message for misuse of RETURN.
sql/share/serbian/errmsg.txt:
New error message for misuse of RETURN.
sql/share/slovak/errmsg.txt:
New error message for misuse of RETURN.
sql/share/spanish/errmsg.txt:
New error message for misuse of RETURN.
sql/share/swedish/errmsg.txt:
New error message for misuse of RETURN.
sql/share/ukrainian/errmsg.txt:
New error message for misuse of RETURN.
sql/sp.cc:
Major rehack to accomodate FUNCTIONs, and to make it easier to add
future in-memory cache of prepared SPs.
sql/sp.h:
Major rehack to accomodate FUNCTIONs, and to make it easier to add
future in-memory cache of prepared SPs.
sql/sp_head.cc:
Now creates FUNCTIONs too. (And got rid of some unnecessary Item_string use.)
sql/sp_head.h:
Now creates FUNCTIONs too. (And got rid of some unnecessary Item_string use.)
sql/sql_lex.h:
New stored FUNCTION commands.
sql/sql_parse.cc:
Added FUNCTION support ("drop" merged with the old UDF code), and made some
additional changes for better error handling (following the sp.cc rehacking).
sql/sql_yacc.yy:
Some former UDF specific symbols renamed.
Added CREATE FUNCTION parsing.
DROP FUNCTION had to be partly merged with the old UDF code, because of the similar
syntax.
RETURN statement added, but still a no-op.
2003-02-21 17:37:05 +01:00
|
|
|
|
2003-11-17 18:21:36 +01:00
|
|
|
int
|
|
|
|
sp_update_procedure(THD *thd, char *name, uint namelen,
|
|
|
|
char *newname, uint newnamelen,
|
|
|
|
char *comment, uint commentlen, enum suid_behaviour suid);
|
|
|
|
|
|
|
|
int
|
|
|
|
sp_show_create_procedure(THD *thd, LEX_STRING *name);
|
|
|
|
|
|
|
|
int
|
|
|
|
db_show_status_procedure(THD *thd, const char *wild);
|
|
|
|
|
2003-02-04 17:40:18 +01:00
|
|
|
sp_head *
|
Most of the groundwork for sprint task 729 (implement FUNCTIONs).
Expanded the mysql.proc table, reworked the find/create/drop functions
completely, added new functions for FUNCTIONs (lotta functions here :),
got rid of some unnecessary use of Item_strings while at it. Extended
the parser correspondingly, and fiddled around a bit to make SP FUNCTIONs
coexist with UDFs.
Can now CREATE and DROP FUNCTIONs. Invoking yet to come...
Docs/sp-implemented.txt:
Updated with info about CASCADE/RESTICT and METHOD, and some answers to questions.
include/mysqld_error.h:
New error message for misuse of RETURN.
mysql-test/install_test_db.sh:
Added enum field to mysql.proc to distinguish between FUNCTION and PROCEDURE.
mysql-test/r/sp.result:
New test for creating and dropping FUNCTIONS.
mysql-test/t/sp.test:
New test for creating and dropping FUNCTIONS.
scripts/mysql_install_db.sh:
Added enum field to mysql.proc to distinguish between FUNCTION and PROCEDURE.
sql/lex.h:
De-UDFed some symbol names, as they are now used for SPs as well.
Added RETURN_SYM.
sql/share/czech/errmsg.txt:
New error message for misuse of RETURN.
sql/share/danish/errmsg.txt:
New error message for misuse of RETURN.
sql/share/dutch/errmsg.txt:
New error message for misuse of RETURN.
sql/share/english/errmsg.txt:
New error message for misuse of RETURN.
sql/share/estonian/errmsg.txt:
New error message for misuse of RETURN.
sql/share/french/errmsg.txt:
New error message for misuse of RETURN.
sql/share/german/errmsg.txt:
New error message for misuse of RETURN.
sql/share/greek/errmsg.txt:
New error message for misuse of RETURN.
sql/share/hungarian/errmsg.txt:
New error message for misuse of RETURN.
sql/share/italian/errmsg.txt:
New error message for misuse of RETURN.
sql/share/japanese/errmsg.txt:
New error message for misuse of RETURN.
sql/share/korean/errmsg.txt:
New error message for misuse of RETURN.
sql/share/norwegian-ny/errmsg.txt:
New error message for misuse of RETURN.
sql/share/norwegian/errmsg.txt:
New error message for misuse of RETURN.
sql/share/polish/errmsg.txt:
New error message for misuse of RETURN.
sql/share/portuguese/errmsg.txt:
New error message for misuse of RETURN.
sql/share/romanian/errmsg.txt:
New error message for misuse of RETURN.
sql/share/russian/errmsg.txt:
New error message for misuse of RETURN.
sql/share/serbian/errmsg.txt:
New error message for misuse of RETURN.
sql/share/slovak/errmsg.txt:
New error message for misuse of RETURN.
sql/share/spanish/errmsg.txt:
New error message for misuse of RETURN.
sql/share/swedish/errmsg.txt:
New error message for misuse of RETURN.
sql/share/ukrainian/errmsg.txt:
New error message for misuse of RETURN.
sql/sp.cc:
Major rehack to accomodate FUNCTIONs, and to make it easier to add
future in-memory cache of prepared SPs.
sql/sp.h:
Major rehack to accomodate FUNCTIONs, and to make it easier to add
future in-memory cache of prepared SPs.
sql/sp_head.cc:
Now creates FUNCTIONs too. (And got rid of some unnecessary Item_string use.)
sql/sp_head.h:
Now creates FUNCTIONs too. (And got rid of some unnecessary Item_string use.)
sql/sql_lex.h:
New stored FUNCTION commands.
sql/sql_parse.cc:
Added FUNCTION support ("drop" merged with the old UDF code), and made some
additional changes for better error handling (following the sp.cc rehacking).
sql/sql_yacc.yy:
Some former UDF specific symbols renamed.
Added CREATE FUNCTION parsing.
DROP FUNCTION had to be partly merged with the old UDF code, because of the similar
syntax.
RETURN statement added, but still a no-op.
2003-02-21 17:37:05 +01:00
|
|
|
sp_find_function(THD *thd, LEX_STRING *name);
|
2003-02-04 17:40:18 +01:00
|
|
|
|
|
|
|
int
|
2003-05-06 18:09:20 +02:00
|
|
|
sp_create_function(THD *thd, char *name, uint namelen, char *def, uint deflen,
|
|
|
|
char *comment, uint commentlen, bool suid);
|
2003-02-04 17:40:18 +01:00
|
|
|
|
|
|
|
int
|
|
|
|
sp_drop_function(THD *thd, char *name, uint namelen);
|
2002-12-12 13:14:23 +01:00
|
|
|
|
2003-11-17 18:21:36 +01:00
|
|
|
int
|
|
|
|
sp_update_function(THD *thd, char *name, uint namelen,
|
|
|
|
char *newname, uint newnamelen,
|
|
|
|
char *comment, uint commentlen, enum suid_behaviour suid);
|
|
|
|
|
|
|
|
int
|
|
|
|
sp_show_create_function(THD *thd, LEX_STRING *name);
|
|
|
|
|
|
|
|
int
|
|
|
|
db_show_status_function(THD *thd, const char *wild);
|
|
|
|
|
2003-02-26 19:22:29 +01:00
|
|
|
// QQ Temporary until the function call detection in sql_lex has been reworked.
|
|
|
|
bool
|
|
|
|
sp_function_exists(THD *thd, LEX_STRING *name);
|
|
|
|
|
2003-03-02 19:17:41 +01:00
|
|
|
|
2003-07-01 18:14:24 +02:00
|
|
|
// This is needed since we have to read the functions before we
|
|
|
|
// do anything else.
|
2003-03-02 19:17:41 +01:00
|
|
|
void
|
|
|
|
sp_add_fun_to_lex(LEX *lex, LEX_STRING fun);
|
|
|
|
void
|
|
|
|
sp_merge_funs(LEX *dst, LEX *src);
|
|
|
|
int
|
|
|
|
sp_cache_functions(THD *thd, LEX *lex);
|
|
|
|
|
2002-12-12 13:14:23 +01:00
|
|
|
#endif /* _SP_H_ */
|