summaryrefslogtreecommitdiff
path: root/sql/sp.h
diff options
context:
space:
mode:
authorunknown <pem@mysql.com>2003-02-21 17:37:05 +0100
committerunknown <pem@mysql.com>2003-02-21 17:37:05 +0100
commit0521fb5444df9a97e0682307242700bd94c6595e (patch)
tree09532f901b8cb45042f6189083d6fe928d50f20f /sql/sp.h
parent3c88ebdc9dec478a44de8f6d55a22c105f1d20f0 (diff)
downloadmariadb-git-0521fb5444df9a97e0682307242700bd94c6595e.tar.gz
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.
Diffstat (limited to 'sql/sp.h')
-rw-r--r--sql/sp.h19
1 files changed, 12 insertions, 7 deletions
diff --git a/sql/sp.h b/sql/sp.h
index 99ea97cba8f..084afb8c8e0 100644
--- a/sql/sp.h
+++ b/sql/sp.h
@@ -18,11 +18,17 @@
#ifndef _SP_H_
#define _SP_H_
-//
-// Finds a stored procedure given its name. Returns NULL if not found.
-//
+// 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
+
sp_head *
-sp_find_procedure(THD *thd, Item_string *name);
+sp_find_procedure(THD *thd, LEX_STRING *name);
int
sp_create_procedure(THD *thd, char *name, uint namelen, char *def, uint deflen);
@@ -30,15 +36,14 @@ sp_create_procedure(THD *thd, char *name, uint namelen, char *def, uint deflen);
int
sp_drop_procedure(THD *thd, char *name, uint namelen);
-#if 0
+
sp_head *
-sp_find_function(THD *thd, Item_string *name);
+sp_find_function(THD *thd, LEX_STRING *name);
int
sp_create_function(THD *thd, char *name, uint namelen, char *def, uint deflen);
int
sp_drop_function(THD *thd, char *name, uint namelen);
-#endif
#endif /* _SP_H_ */