Commit graph

64 commits

Author SHA1 Message Date
pem@mysql.comhem.se
6aad6835c6 Fixed BUG#9598: stored procedure call within stored procedure
overwrites IN variable
  and added error checking of variables for [IN]OUT parameters while
  rewriting the out parameter handling.
2005-04-14 14:52:35 +02:00
pem@mysql.comhem.se
2038ced40c Fixed BUG#9073: Able to declare two handlers for same condition in same scope 2005-04-08 19:58:04 +02:00
pem@mysql.comhem.se
e99da54fd5 Fixed BUG#7299: Stored procedures: exception handler catches not-found conditions 2005-04-08 16:05:16 +02:00
dlenev@brandersnatch.localdomain
8d05aa0f02 Moved test for bug #9566 "explicit LOCK TABLE and store procedures result in illegal
state" to sp-error.test.

According to Per-Erik all SP related tests which should result in error
should go into sp-error.test and not in sp.test, because we want to be
able to run sp.test using normal client.
2005-04-07 11:57:47 +04:00
pem@mysql.comhem.se
8df8afc270 Fixed BUG#6600: Stored procedure crash after repeated calls with check table.
Sedond attempt: Simply disallow CHECK in SPs, since it can't work.
2005-03-30 17:43:52 +02:00
pem@mysql.comhem.se
54a2448bce Fixed BUG#8760: Stored Procedures: Invalid SQLSTATE is allowed in
a DECLARE ? HANDLER FOR stmt.
2005-02-28 18:07:06 +01:00
pem@mysql.comhem.se
2c26ebe359 WL#2130: Table locking for stored FUNCTIONs
Collect all tables and SPs refered by a statement, and open all tables
with an implicit LOCK TABLES. Do find things refered by triggers and views,
we open them first (and then repeat this until nothing new is found), before
doing the actual lock tables.
2005-02-08 20:52:50 +01:00
jimw@mysql.com
98d7964d2a Fix 'SHOW CREATE FUNCTION' to say 'FUNCTION' in its error message. (Bug #6338) 2005-01-03 19:53:54 +01:00
pem@mysql.comhem.se
a1e0e96e2d Fixed BUG#6807: Stored procedure crash if CREATE PROCEDURE ... KILL QUERY
...and for PURGE BEFORE too. (Don't fix_fields in the parser!)
2004-11-25 16:13:06 +01:00
pem@mysql.comhem.se
2c428ca09d Fixed BUG#6030: Stored procedure has no appropriate DROP privilege.
...and no ALTER privilege either.
  For now, only the definer and root can drop or alter an SP.
2004-10-22 20:29:06 +02:00
pem@mysql.comhem.se
ebf8dc0da6 Fixed BUG#6027: Stored procedures can be renamed.
Removed the support for renaming SPs. It's non-standard, conflicted with a standard
syntax, and was a bit broken anyway.
2004-10-22 19:05:17 +02:00
pem@mysql.comhem.se
8b1a6d377f Revised BUG#5000: SPs can be created with no default database.
Now simply give an error if no database. (The "global SP feature" will be
done using PATH instead.)
2004-10-07 15:32:36 +02:00
pem@mysql.comhem.se
624cf0e537 Fixed BUG#3294: Stored procedure crash if table dropped before use.
Dropping the table was not the real problem, the problem was with errors
  occuring within error handlers.
2004-09-10 11:11:52 +02:00
monty@mysql.com
49cd04b510 Merge on pull 2004-09-09 07:26:28 +03:00
monty@mysql.com
f2829d0386 After merge fixes of merge with 4.1 that included the new arena code.
Fixed (together with Guilhem) bugs in mysqlbinlog regarding --offset
Prefix addresses with 0x for easier comparisons of debug logs
Fixed problem where MySQL choosed index-read even if there would be a much better range on the same index
This fix changed some 'index' queries to 'range' queries in the test suite
Don't create 'dummy' WHERE clause for trivial WHERE clauses where we can remove the WHERE clause.
This fix removed of a lot of 'Using where' notes in the test suite.
Give NOTE instead of WARNING if table/function doesn't exists when using DROP IF EXISTS
Give NOTE instead of WARNING for safe field-type conversions
2004-09-09 06:59:26 +03:00
pem@mysql.comhem.se
b83af8607a 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.
2004-09-08 14:23:14 +02:00
pem@mysql.comhem.se
c81b848d20 Major rehacking and cleanup of sp_pcontext.
This finishes (almost) WL#2002: Implement stored procedure GOTO.
Only the syntax issue for free labels remains ("label L;" vs "L:").
2004-08-26 12:54:30 +02:00
pem@mysql.comhem.se
6b5a6cdf99 Fixed BUG#3157: Crash if stored procedure contains IF EXISTS,
and BUG#336: Subselects with tables does not work as values for
local SP variables (which was closed before with a temp. fix, but not
actually fixed).
2004-08-24 16:07:39 +02:00
pem@mysql.comhem.se
38b4cbbbd5 WL#2002: Implement stored procedure GOTO.
Mostly done, it works, but the temporary LABEL syntax still to be fixed.
2004-08-17 20:20:58 +02:00
pem@mysql.comhem.se
7e6bade23b Fixed BUG#434: Stored procedure which drops itself causes crash.
Simply disallow it, just as we disallow creation of routines from within
other SPs.
2004-07-29 17:33:45 +02:00
serg@serg.mylan
aa35efd292 after merge fixes 2004-07-22 00:26:33 +02:00
pem@mysql.comhem.se
c0ae841258 Fixed BUG#2653: Undeclared variables not detected in stored procedures.
We now get an run-time error instead of a crash (although a slightly misleading
error message, but it's an improvement).
2004-07-21 14:53:09 +02:00
monty@mysql.com
5b3c418b48 After merge fixes
Note: The following tests fails
- fulltext (Sergei has promised to fix)
- rpl_charset (Guilhem should fix)
- rpl_timezone (Dimitray has promised to fix)

Sanja needs to check out the calling of close_thread_tables() in sp_head.cc
2004-07-15 04:19:07 +03:00
paul@kite-hub.kitebird.com
23fa7987e0 variables.result, sp-error.result:
fix up test result.
2004-06-16 00:46:26 -05:00
pem@mysql.comhem.se
ecd424ac58 Fixed BUG#3339: Stored procedures in nonexistent schemas are uncallable.
Also added some related security tests and corrected related error messages.
2004-06-15 15:42:28 +02:00
pem@mysql.comhem.se
a3082cd3c9 Added test case for SELECT INTO with too many rows. 2004-06-09 18:50:03 +02:00
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
d42b145817 Post-merge fixes, some quite complex. client/mysqlbinlog.cc and sql/log_event.cc
merged manually by guilhem.
2004-04-28 12:08:54 +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
329013f99e Fixed BUG#3287: Stored Procedure Case Statement Not SQL:2003 Compliant. 2004-03-29 12:29:06 +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
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.comhem.se
f9e73c7716 Post-merge fixes. 2004-02-11 18:21:55 +01:00
pem@mysql.comhem.se
370a43a32a Fixed BUG#2329: Crash if insert with variable name in stored procedure.
Found a few more places in the parser (insert, replace and update) where
local stored procedure variables should not be recognized.
2004-01-14 12:47:03 +01:00
pem@mysql.comhem.se
cfd97c022e Fix BUG#2259: Crash after fetch from not-open cursor in stored procedure
Initialize and test properly when cleaning up, to avoid crash in some error cases.
2004-01-08 10:37:31 +01:00
pem@mysql.comhem.se
4975595660 Fix BUG#2272: Crash if update with variable name in stored procedure.
Parse column names (and not variables) only in UPDATE ... SET ...
2004-01-08 09:27:29 +01:00
pem@mysql.comhem.se
bb51272bd1 Post-merge fixes.
Multiple result sets from stored procedures now works with the
mysql and mysqltest clients.
2003-12-16 18:09:22 +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
cbdc0b4c3a Post-merge fixes. 2003-12-05 14:45:48 +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
3ed561d3cf Post-merge fixes. 2003-12-01 18:24:09 +01:00
pem@mysql.comhem.se
d8bf426b80 Fixed BUG#1965: Opening a cursor hangs client when malformed select fails
and BUG#1966: "select 1 into a" on top-level hangs client
2003-11-27 16:48:21 +01:00
pem@mysql.comhem.se
47f9c2946f Changed "query" into "statement", and corrected SQL state code (04000->0A000). 2003-11-24 18:24:14 +01:00
pem@mysql.comhem.se
d9b8a35eeb Translated 5.0 error codes into sql states. 2003-11-21 18:23:05 +01:00
pem@mysql.comhem.se
96f1252899 Bugfixes in SHOW CREATE PROCEDURE/FUNCTION and SHOW PROCEDURE/FUNCTION STATUS;
- dropped routines should not show up in status
- error handling for non-existing routines

+ some cleanup.
2003-11-20 15:07:22 +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
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
81c4cca686 Changed single generic error code/message into different ones for duplicate things.
(For multi-lingual support.)
Also fixed memory leak when aborting parsing for a duplicate cursor.
2003-11-14 13:46:50 +01:00
pem@mysql.comhem.se
c38bb3d79d Various bug fixes:
- Duplicate parameters/variables, conditions and cursors (not allowed).
  - ITERATE in labelled BEGIN-END (not allowed).
  - Missing SQLSTATE [VALUE] keywords in CONDITION/HANDLER declaration (added).
  - Empty BEGIN-END (now allowed).
  - End label (now optional).
2003-11-13 19:34:56 +01:00