Commit graph

126 commits

Author SHA1 Message Date
pem@mysql.comhem.se
ec92106535 Post-merge fixes.
Note: One sp.test still fails (prime), and rpl_server_id2.test fails (will be fixed by guilhem ASAP).
2004-05-14 16:00:57 +02:00
pem@mysql.comhem.se
eb7319e850 Fixed BUG#2772: Function with character set clause fails in stored procedures.
Complex return types were not stored correctly in the mysql.proc table.
2004-04-06 13:26:53 +02:00
pem@mysql.comhem.se
95dcdde134 Fixed BUG#3287: Stored procedure handler scope outside of begin/end.
Backpatching overwrote already backpatched instructions, which made it
skip the hpop instruction; possibly not only a problem for handlers,
but this is one known case when it happened.
2004-04-05 17:01:19 +02:00
pem@mysql.comhem.se
52c820fbc5 Enforce standard declaration order in SPs.
Added new test cases for this, and adjusted old tests accordingly,
and new error codes and messages.
Fixed bugs in some tests (bug2673 and use test).
Added debug printing of instructions in SPs.
2004-03-29 11:16:45 +02:00
pem@mysql.comhem.se
13987057f6 WL#1366: Use the schema (db) associated with an SP.
Phase 3: Made qualified names work for functions as well.
2004-03-19 19:01:54 +01:00
pem@mysql.comhem.se
6c6bbba007 WL#1366: Use the schema (db) associated with an SP.
Phase 2: Make SPs belong to a DB, and use qualified names.
  As a side effect, using USE in an SP is no longer allowed.
  (It just doesn't work otherwise.)
2004-03-11 17:18:59 +01:00
pem@mysql.com
91cc4b288e Merge mysql.com:/usr/local/bk/mysql-5.0
into mysql.com:/home/pem/work/mysql-5.0
2004-03-02 16:01:02 +01:00
dlenev@brandersnatch.localdomain
3c58ae9e74 Fixed small race condition, when global query_id was modified
without proper locking.
2004-03-01 09:15:33 +03:00
pem@mysql.comhem.se
b205759949 WL#1366: Use the schema (db) associated with an SP.
Phase 1: Introduced sp_name class, for qualified name support.
2004-02-17 17:36:53 +01:00
Sinisa@sinisa.nasamreza.org
4320327826 sp.test:
test case for the fix for bug #2614
sp_head.cc:
  A fix for a crashing bug in stored procedures with INSERT ... SELECT ... (Bug #2514)
2004-02-03 16:22:43 +02:00
pem@mysql.comhem.se
b2efad935b Check for possible stack overrun in SP execution. 2004-01-26 15:17:35 +01:00
pem@mysql.comhem.se
bfdf9d3cc4 Fixed BUG#2227: Server crash with stored procedure call.
(Meaning "... with SELECT v", where v is a local variable.)
2004-01-21 14:28:35 +01:00
pem@mysql.comhem.se
1ef17f0a14 Fix BUG#2269: Lost connect if stored procedure called before USE
(And some minor correction of cursor open)
2004-01-09 09:36:37 +01:00
monty@mysql.com
c6ed2a625b Update for VC++
(Fixed project files, compiler warnings etc..)
2003-12-21 02:07:45 +02:00
pem@mysql.comhem.se
a7b7a40c5f Forgot to wrap things in #ifndef NO_EMBEDDED_ACCESS_CHECKS for the embedded server.
Added missing cleanup in sp-security.test.
2003-12-16 14:15:27 +01:00
pem@mysql.comhem.se
45e5896363 Fixed various memory leaks. 2003-12-15 13:24:16 +01:00
pem@mysql.comhem.se
07541b6abf WL#1365: Implement definer's rights execution of stored procedures.
(Also put the hostpart back in the definer column.)
2003-12-13 16:40:52 +01:00
pem@mysql.comhem.se
7a20e5282e In order to make ALTER PROCEDURE|FUNCTION work correctly, and in general to
make characteristics (and SHOW) work right, we had to separate the old
definition blob in the mysql.proc table into separate fields for parameters,
return type, and body, and handle the characteristics (like SQL SECURITY)
separately... and then reassemble the CREATE string for parsing, of course.
This is rather ugly, mostly the parser bit. (Hopefully that will be better
with the new parser.)
2003-12-12 14:05:29 +01:00
pem@mysql.comhem.se
b27e9d6052 WL#1363: Update the mysql.proc table and add new fields.
Also made the parsing and handling of SP characteristics
more general and extendable, and added a few ch:istics.
2003-12-10 19:05:37 +01:00
pem@mysql.comhem.se
98bfc5a6c6 Fixed another compiler error on HP-UX. 2003-12-04 15:54:37 +01:00
pem@mysql.comhem.se
a5780a4815 Fixed BUG#336: Subselects with tables does not work as values for local SP variables
and BUG#1654: Stored Procedure Crash if contains subquery and set function

Disallowed subselects in RETURN (for FUNCTIONs) and SET of local variables.
The latter should work, but turned out to be difficult to fix, so we just
disallow it for the time being.
2003-12-04 15:17:55 +01:00
pem@mysql.comhem.se
86039a34e5 Made Item_splocal printable. 2003-11-21 14:00:40 +01:00
pem@mysql.comhem.se
5e46a05960 Fixed BUG#1874: Don't call fix_fields() indiscriminately, it resets null_value
for some items, which made aggregates like MIN(), MAX() and SUM() fail.
2003-11-20 18:30:02 +01:00
pem@mysql.comhem.se
5b355ea6f5 Post-merge fixes. 2003-11-19 16:59:35 +01:00
pem@mysql.comhem.se
c4871b240d Fixed BUG#1862 (flush table in SPs didn't work).
Fixed various bugs: setting local variables to NULL, SELECT INTO var now actually
might work, SELECT INTO with not row now gives a "no data" warning (instead of
the "empty query" error), etc.
Updated test cases accordingly.
2003-11-19 11:26:18 +01:00
gluh@gluh.mysql.r18.ru
e44a0c2aeb Merge sgluhov@bk-internal.mysql.com:/home/bk/mysql-5.0
into gluh.mysql.r18.ru:/home/gluh/mysql-5.0.sp
2003-11-17 21:24:03 +04:00
gluh@gluh.mysql.r18.ru
ee4ed0c969 WL#1241: SHOW PROCEDURE/FUNCTION
WL#1263: Support for the attributes COMMENT and SUID
         in CREATE/ALTER PROCEDURE/FUNCTION
2003-11-17 21:21:36 +04:00
pem@mysql.comhem.se
34d76c9319 Bugfix, handling null values. 2003-11-17 13:33:47 +01:00
pem@mysql.comhem.se
bfe6ef9c9b Fix BUG#1656: Have to initialize OUT parameters too, in case they're not
later set by the procedure.
2003-10-28 15:43:49 +01:00
pem@mysql.comhem.se
52dae5c79e Bugfix; added another method to Item_splocal, updated tests, and added previous
fix to functions as well.
2003-10-20 16:59:45 +02:00
pem@mysql.comhem.se
98397562c0 Bugfix. Local variables are now initialized to null. 2003-10-17 17:13:49 +02:00
pem@mysql.telia.com
1f1a8531d1 Handle user variables (@-vars) as OUT and INOUT parameters in SPs. 2003-10-16 15:45:27 +02:00
pem@mysql.telia.com
225aada6d6 Fix for BUG#1495: Evaluate items before setting a local variable with SELECT INTO.
Also copy and restore order_list and group_list for selects in SPs.
2003-10-14 12:59:28 +02:00
pem@mysql.telia.com
689bb84f72 WL#962: Added simple, read-only, non-scrolling, asensitive cursors in SPs, using the
(updated) Protocol_cursor class.
Also did some bug fixes.
2003-10-10 16:57:21 +02:00
pem@mysql.telia.com
e8634f80bd Check that a FUNCTION contains RETURN and that we actually get a return value. 2003-10-03 17:38:12 +02:00
pem@mysql.telia.com
dbf45cbc3c Fixed BUG#822: Copying and clearing some things in thd/lex when
executing sub-statements (selects) prevents crashes intermittent
crashes.
Also fixed bug in sql_yacc.yy (generated a hpop instruction when
not needed).
2003-10-03 12:39:12 +02:00
pem@mysql.telia.com
04f0570fe8 Implemented SP CONDITIONs and HANDLERs, with the extension of handling
MySQL error codes as well.
(No UNDO HANDLERs yet, and no SIGNAL or RESIGNAL.)
WL#850
2003-09-16 14:26:08 +02:00
pem@mysql.telia.com
7a7f3c13d4 Adopt to the introduction of a separate CLIENT_MULTI_RESULTS flag. 2003-08-27 17:04:33 +02:00
pem@mysql.telia.com
08e5a7e135 Post-merge fixes. 2003-08-26 17:41:40 +02:00
pem@mysql.com
6d225437ed Code cleanup (and moved sp cache to separate file). 2003-07-03 15:58:37 +02:00
pem@mysql.com
4006e95808 Bugfixes for the sp_head memroot stuff. 2003-07-01 17:19:48 +02:00
pem@mysql.com
9f14ae7516 sp_head now has its own mem_root (WL#961).
Also fixed some difficult memory leaks that became apparent
in this task.
2003-06-29 18:15:17 +02:00
pem@mysql.com
541c94fcf1 Fixed bug #643, which caused intermittent crashes in net_printf() with repeated
syntax errors in stored procedures.
2003-06-12 15:31:20 +02:00
gluh@gluh.mysql.r18.ru
7c6522a74e 'Expand the mysql.proc table to include (almost) all fields' task(851)
Fix after review
2003-06-02 14:25:01 +05:00
pem@mysql.com
4523a7b179 Adopt SP stuff to the new lex pointer. 2003-05-23 15:32:31 +02:00
vva@eagle.mysql.r18.ru
384b10e2af Merge eagle.mysql.r18.ru:/home/vva/work/mysql.orig/clear/mysql-5.0
into eagle.mysql.r18.ru:/home/vva/work/LEX_PTR/mysql-5.0
2003-05-14 19:48:58 -04:00
gluh@gluh.mysql.r18.ru
33cabdc3b1 Expand the mysql.proc table 2003-05-06 21:09:20 +05:00
vva@eagle.mysql.r18.ru
afd581edd3 made lex a pointer in THD 2003-05-05 14:54:37 -04:00
pem@mysql.com
6c85c6aa6a Post-fix of bug #302 fix.
Fixed bug #320.
Some new tests and cosmetic changes.
Another strcasecmp() replaced.
2003-04-27 17:35:54 +02:00
bell@sanja.is.com.ua
b9a4bf8cad subselect in procedure argument list (Bug #302) 2003-04-23 22:31:47 +03:00
pem@mysql.com
cba91cce8c Fixes bug #302: call u((select 1)) now works.
More complex cases, like call u((select x from table limit 1)) does not.
2003-04-23 16:21:56 +02:00
pem@mysql.com
a4e065920b Made multiple queries (SELECT without INTO) work in SPs.
This included bug fixes in the 4.1 protocol (actually send and receive the
server_status flags).
2003-04-23 09:22:54 +02:00
pem@mysql.com
7b5df9edec Check the number of args to SPs.
Fixes bug #280.
2003-04-17 13:20:02 +02:00
pem@mysql.com
5c4122d3e0 Fixed the last memory leaks in the SP code. 2003-04-03 20:00:52 +02:00
pem@mysql.com
1fc3582b7d Got rid of the last unecessary Item_strings. 2003-04-03 16:00:09 +02:00
pem@mysql.com
c673fcb813 Getting rid of lots of memory leaks (but not quite all of them yet,
some will go away when temporary code is replaced).
2003-04-02 20:42:28 +02:00
pem@mysql.com
017ba13005 Check for thd->killed in execution loop. (Makes more graceful behaviour in
certain interrupt cases.)
2003-03-28 17:02:31 +01:00
pem@mysql.com
ac44a5f66e Replaced a couple of strcasecmps. 2003-03-27 17:35:27 +01:00
pem@mysql.com
483efba239 Fixed save/restore of current database when calling a procedure. 2003-03-26 15:02:48 +01:00
pem@mysql.com
0d95f36a12 Post post merge fix. Made the broken ip test work again. 2003-03-20 11:57:05 +01:00
pem@mysql.com
12f771d9e7 Improved error handling regarding SPs (with info like names etc in the output).
Disabled queries in FUNCTIONs.
2003-03-05 19:45:17 +01:00
pem@mysql.com
8049daf202 Made FUNCTIONs work in insert and select queries, as well as nested function invocations.
Had to add a cahing mechanism which is in parts an ugly kludge, but it will be
reworked once the real SP caching is implemented.
2003-03-02 19:17:41 +01:00
pem@mysql.com
b6ab762dc1 Closing tables during SP execution the proper way. 2003-02-28 15:07:14 +01:00
pem@mysql.com
16cff7e75d A small step forward. Fixed a few bugs and made string type functions work,
but still strange interferences between multiple function invocations...
2003-02-27 19:08:52 +01:00
pem@mysql.com
ca2e77ca7a Made stored FUNCTION invokation work almost always. Still buggy and unstable, and
various known problems, but good enough for a checkpoint commit.
2003-02-26 19:22:29 +01:00
pem@mysql.com
d8c75ec8aa 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...
2003-02-21 17:37:05 +01:00
pem@mysql.com
d53fc31958 Fixed some DBUGing, and optimized SET slightly. 2003-02-12 16:17:03 +01:00
pem@mysql.com
b6890a7930 Fixed crash bug when certain procedures are called from the top level. 2003-02-02 17:44:39 +01:00
pem@mysql.com
b863798a7c Fixed some basic error handling for SP functions in mysql_execute_command(). 2003-01-15 15:39:36 +01:00
pem@mysql.com
204aa97280 Fixed some of the data collection during parsing. 2002-12-19 18:43:25 +01:00
pem@mysql.com
58d3dda33f Added parsing of CASE (both generic and "simple"). 2002-12-17 10:01:52 +01:00
pem@mysql.com
b1593c9a69 Fixed the broken backpatching implementation.
Implemented IF-THEN-ELSE.
2002-12-16 15:40:44 +01:00
pem@mysql.com
113b9240d1 Added collection of called procedures in a list.
Fixed eval bug; now conditions with local variables work in WHILE et al.
Made mysql_install_db.sh create proc table.
2002-12-13 18:25:36 +01:00
pem@mysql.com
77b671f594 Moved create/find/drop functions to a separate files (sp.cc,sp.h).
Fixed backpatching of forward jumps.
Implemented LOOP, WHILE, REPEAT (temporarily known as SPREPEAT).

Known bug: Expression evaluation still not quite ok (e.g. "x > 0"),
which is why IF and CASE is not yet implemented.
2002-12-12 13:14:23 +01:00
pem@mysql.com
f0137bcd68 Fixed bugs in the parameter evaluation and modified the execution engine
for better jump support. Some flow control support added too (but not
complete).
2002-12-11 14:24:29 +01:00
pem@mysql.com
aae07a4d45 Simplistic, experimental framework for Stored Procedures (SPs).
Implements creation and dropping of PROCEDUREs, IN, OUT, and INOUT parameters,
single-statement procedures, rudimentary multi-statement (begin-end) prodedures
(when the client can handle it), and local variables.
Missing most of the embedded SQL language, all attributes, FUNCTIONs, error handling,
reparses procedures at each call (no caching), etc, etc.
Certainly buggy too, but procedures can actually be created and called....
2002-12-08 19:59:22 +01:00