diff options
author | unknown <pem@mysql.com> | 2003-03-26 15:02:48 +0100 |
---|---|---|
committer | unknown <pem@mysql.com> | 2003-03-26 15:02:48 +0100 |
commit | 2c9ef84cc35198c1ae888a335c2e228ecfb6b81d (patch) | |
tree | 28c2c48d31636e6c403dc49462d3777e39901b2f /Docs/sp-imp-spec.txt | |
parent | 3946b8235c6f4dfbb5a1aeefed5b620bf89df34e (diff) | |
download | mariadb-git-2c9ef84cc35198c1ae888a335c2e228ecfb6b81d.tar.gz |
Fixed save/restore of current database when calling a procedure.
Diffstat (limited to 'Docs/sp-imp-spec.txt')
-rw-r--r-- | Docs/sp-imp-spec.txt | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/Docs/sp-imp-spec.txt b/Docs/sp-imp-spec.txt index 1303ae19c5c..385625464f1 100644 --- a/Docs/sp-imp-spec.txt +++ b/Docs/sp-imp-spec.txt @@ -243,6 +243,23 @@ 5) On success, set the new values of the OUT and INOUT parameters in the caller's frame. + - USE database + + Before executing the instruction we also keeps the current default + database (if any). If this was changed during execution (i.e. a "USE" + statement has been executed), we restore the current database to the + original. + + This is the most useful way to handle USE in procedures. If we didn't, + the caller would find himself in a different database after calling + a function, which can be confusing. + Restoring the database also gives full freedom to the procedure writer: + - It's possible to write "general" procedures that are independent of + the actual database name. + - It's possible to write procedures that work on a particular database + by calling USE, without having to use fully qualified table names + everywhere (which doesn't help if you want to call other, "general", + procedures anyway). - Evaluating Items @@ -340,6 +357,9 @@ Dropping is done by simply getting the procedure with the sp_find() function and calling sp_drop() (both in sp.{cc,h}). + DROP PROCEDURE/FUNCTION also supports the non-standard "IF EXISTS", + analogous to other DROP statements in MySQL. + - Class and function APIs |