Commit graph

199 commits

Author SHA1 Message Date
pem@mysql.comhem.se
f3a0ba3515 Fixed BUG#4905: Stored procedure doesn't clear for "Rows affected". 2004-09-29 18:55:05 +02:00
monty@mishka.local
1fc7e6af85 Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into mishka.local:/home/my/mysql-5.0
2004-09-28 20:19:03 +03:00
monty@mishka.local
f2941380c4 Strict mode & better warnings
Under strict mode MySQL will generate an error message if there was any conversion when assigning data to a field.
Added checking of date/datetime fields.
If strict mode, give error if we have not given value to field without a default value (for INSERT)
2004-09-28 20:08:00 +03:00
pem@mysql.comhem.se
5b10e3e5b5 Fixed BUG#3583: query cache doesn't work for stored procedures. 2004-09-17 15:40:38 +02:00
pem@mysql.comhem.se
728000b225 Fixed BUG#4941: Stored procedure crash fetching null value into variable. 2004-09-10 16:28:11 +02:00
pem@mysql.comhem.se
dde44b8c8c Fixed BUG#4487: Stored procedure connection aborted if uninitialized char. 2004-09-09 19:08:54 +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
3aa2a62f37 Fixed BUG#5258: Stored procedure modified date is 0000-00-00.
Althought techically not a but (as it's functioning as designed),
  it was decided that the design should be changed. Some users have
  a problem with dates being '0000-00-00' and the SQL standard specifies
  that the modification date should be the same as the creation date
  at creation.
2004-09-08 11:42:18 +02:00
pem@mysql.comhem.se
e04f4fb46c Fixed BUG#5307: Stored procedure allows statement after BEGIN ... END. 2004-09-02 19:14:34 +02:00
pem@mysql.comhem.se
fee115adca Fixed BUG#5287: Stored procedure crash if leave outside loop.
Bug in diff_handlers and diff_cursors made it attempt to pop
the wrong number at jumps sometimes.
2004-09-02 17:24:25 +02:00
acurtis@pcgem.rdg.cyberkinetica.com
7ee2f2c6bb Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into pcgem.rdg.cyberkinetica.com:/usr/home/acurtis/work/mysql-5.0
2004-08-30 22:11:14 +01:00
acurtis@pcgem.rdg.cyberkinetica.com
203debc666 Fix column name where it starts with a backtick 2004-08-30 22:08:51 +01:00
pem@mysql.comhem.se
12b1c4b330 Fixed BUG#5279: Stored procedure packets out of order if CHECKSUM TABLE. 2004-08-30 14:52:21 +02:00
pem@mysql.comhem.se
f723438555 Fixed BUG#5251: mysql changes creation time of a procedure/function when altering. 2004-08-27 16:41:34 +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
dlenev@brandersnatch.localdomain
15547058e5 Made sp.test more repeatable. 2004-08-13 20:02:52 +04:00
pem@mysql.comhem.se
33c58f8c67 Removed an SP test case that's not repeatable over different builds/platforms. 2004-08-06 17:04:55 +02:00
pem@mysql.comhem.se
a21487fb4f Fixed BUG#4904: Stored procedure crash if continue handler for HY000 errors.
The description is not entirerly correct. The issue was follow-up errors
  where the first error is not caught - in which case it's often a system
  error with errcode < 1000 (which are mapped by default to 'HY000'). In this
  case the error state is different from what was assumed in the execution
  loop.
2004-08-06 15:21:28 +02:00
pem@mysql.comhem.se
015b4145da Fixed BUG#4902: Stored procedure with SHOW WARNINGS leads to packet error,
and tried to do it properly this time, digging out all show commands that
  need the multi results flag set.
2004-08-06 13:47:01 +02:00
pem@mysql.comhem.se
714c3c0942 Fixed BUG#4318: Stored Procedure packet error if HANDLER statement,
at least partially. It doesn't crash or give packets out of order
any more, but it's unclear why it doesn't actually return anything
from within an SP. This should be investigated at some point, but
for the moment this will have to do. (It is a rather obscure feature... :)
2004-07-29 16:52:17 +02:00
pem@mysql.comhem.se
bebaaac57d New test case for BUG#4726: Stored procedure crash when looping over SELECT with complex WHERE's.
(The fix was merged in from 4.1)
2004-07-23 19:52:06 +02:00
pem@mysql.comhem.se
e9507f0e1a Fixed BUG#4579: Execution of SP crashes server.
Sub-CALLs of procedures zapped thd->current_arena for good.
2004-07-22 16:46:59 +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
pem@mysql.comhem.se
26ec49f1a8 Fixed BUG#3368: Stored procedure crash if group_concat(variable). 2004-06-15 14:26:19 +02:00
pem@mysql.comhem.se
ad19125447 Fixed BUG#3843: ANALYZE TABLE inside stored procedure causes 'Packets out of order' error. 2004-06-14 12:38:54 +02:00
pem@mysql.comhem.se
078f717804 Fixed BUG#3132: Stored function returns empty when used in union. 2004-06-10 17:07:53 +02:00
pem@mysql.comhem.se
cc897576fe Fixed BUG#2564: SHOW CREATE inconsistent W.R.T ANSI_QUOTES.
It's not possible to quote the definition according to the current sql_mode
setting, so instead we use the setting stored with the SP (that's how it's
parsed anyway), and show this setting in the SHOW CREATE output.
2004-06-09 14:19:43 +02:00
pem@mysql.comhem.se
27abb69250 Fixed BUG#2460: Crash wih Stored Procedure and UNION. 2004-05-28 19:43:06 +02:00
pem@mysql.comhem.se
a4729a9052 Added test cases for the following bugs that have been fixed by recent changes:
BUG#1863: CREATE TABLE in Stored Procedure sometimes crashes on repeated calls.
 BUG#2656: select with join in stored procedure: erroneous result on 2nd call.
 BUG#3426: IF x IS NULL in stored procedure fails on second call within connection.
 BUG#3448: Stored Procedures with inner joins possible bug.
 BUG#3734: Stored procedure returns wrong rows with fulltext parameter.
 BUG#3863: Stored procedure crash when incrementing variable in a loop.

(And corrected the row count output to the client after CALL)
2004-05-28 18:33:14 +02:00
bell@sanja.is.com.ua
c7396f8d20 PS and SP made compatible in mechanism used for preparing query for rexecutions (Bug #2266) 2004-05-20 02:02:49 +03:00
pem@mysql.comhem.se
e1182c5226 Correction of WL#1567: row_count() is -1 following non-insert/update/delete
statements.
2004-05-04 17:18:47 +02:00
pem@mysql.comhem.se
296ba0ea57 WL#1567: Add ROW_COUNT() Function to retrieve count of rows updated/inserted/deleted 2004-05-04 13:45:20 +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
1541f2e794 Fixed BUG#2780: Stored procedure exit handler ignored for warnings.
Actually catch pushed warnings.
2004-04-06 16:29:38 +02:00
pem@mysql.comhem.se
4a6e6251e7 Fixed BUG#2776: Stored procedure crash if variable assigned to default.
Keep track on the default value and use it. (Or NULL, if not declared.)
2004-04-06 15:48:58 +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
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
5954e94fa7 Fixed BUG#3259: Stored procedure names are case sensitive.
Procedure names were unintentionally case-sensitive when read from the database
(but case-insensitive when fetched from the cache).
Note that the DB-part of qualified names is still case-sensitive (for consistency
with other usage in mysql).
2004-03-23 12:04:40 +01:00
pem@mysql.comhem.se
5476eb0709 WL#1366: Use the schema (db) associated with an SP.
Phase 4 (final): Remove associated stored procedures when a database is dropped.
2004-03-22 14:44:41 +01:00
pem@mysql.com
786f823248 Merge 2004-03-18 15:08:17 +01:00
pem@mysql.comhem.se
0411f45801 Fix BUG#2674: Crash if return system variable in stored procedures.
Had to initialize some fields in lex before parsing an SP read from
mysql.proc.
2004-03-17 12:09:03 +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.comhem.se
5344528b00 Fixed test for BUG#2614 (right name, right place, etc...),
and updated sp.result as well.
2004-02-03 15:58:22 +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.com
40f21c8aa7 Merge mysql.com:/usr/local/bk/mysql-5.0
into mysql.com:/home/pem/work/mysql-5.0
2004-01-14 18:20:49 +01:00
pem@mysql.comhem.se
a1ff4d65ff Fixed BUG#2267: Lost connect if stored procedure has SHOW FUNCTION STATUS.
(This might not be enough, could be more statements that must be detected...)
2004-01-14 18:18:29 +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
c40e51f283 Fix BUG#2260: Handler NOT FOUND declaration does't work in stored procedure 2004-01-08 10:55:10 +01:00
monty@mysql.com
26aae2abbb Fixed memory leaks in SP
Some code cleanup
2003-12-21 12:48:03 +02: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
2796e299e6 Don't want host in the definer's column. 2003-12-12 14:12:38 +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
7bfbfc308f WL#1364: Store some environmental values with SPs and use at invokation
sql_mode is stored and used with SPs.
sql_select_limit is always unlimited in SPs.
2003-12-11 12:23:50 +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
301d8137c0 New test cases for BUG#1653 (recalling a procedure after replacing a faulty
table definition crashed), and recursive calls.
2003-12-05 18:52:33 +01:00
pem@mysql.comhem.se
3ed561d3cf Post-merge fixes. 2003-12-01 18:24:09 +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
05f25feaa9 Handle null values correctly in SP local variables. 2003-11-20 16:14:24 +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
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
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
692609537d Post-merge fixes. 2003-10-23 16:06:51 +02: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
c258c86177 Fix for BUG#1547: "SELECT ... WHERE field = var" sometimes give the wrong result in SPs
Two missing methods added to Item_splocal + test case.
2003-10-15 19:03:37 +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
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.com
4523a7b179 Adopt SP stuff to the new lex pointer. 2003-05-23 15:32:31 +02: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
pem@mysql.com
462430ba55 Post merge fixes. 2003-04-04 15:47:43 +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@per-erik-martins-dator.local
64552a658d Implemented DEFAULT for DECLARE variables. 2003-03-30 13:25:43 +02: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
6822eb5ec0 Post-merge fixes. 2003-03-19 11:36:32 +01:00
pem@mysql.com
dba598cddd Fixed reentrantness bugs in select (lex->result) and select_dumpvar, and added cool
prime number test example.
2003-03-06 19:16:46 +01:00
pem@mysql.com
c4b76c2694 New FUNCTION documentation, and a minor test case modification. 2003-03-03 15:03:19 +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
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
52cd3e3142 Fixed SELECT INTO OUTFILE/DUMPFILE and stored procedures, and extended and
reorganized the sp.test file.
2003-02-19 12:42:32 +01:00
pem@mysql.com
58d0b0ea1a Added another select into test. 2003-02-02 17:41:21 +01:00
Sinisa@sinisa.nasamreza.org
d54d67b5d8 Merge sinisa@work.mysql.com:/home/bk/mysql-5.0
into sinisa.nasamreza.org:/mnt/work/petica
2003-01-28 14:44:13 +02:00
pem@mysql.com
a1d21d892e Added check for selects without into in SPs, and updated error messages and tests
accordingly.
2003-01-23 14:00:32 +01:00
vva@eagle.mysql.r18.ru
1fd4866322 solve the lex conflict between the existing repeat() function
and repeat SP-construction
2003-01-23 17:00:31 +04:00
Sinisa@sinisa.nasamreza.org
de135f50b8 Changing some proc names to a more suitable one. 2003-01-20 15:38:35 +02:00
Sinisa@sinisa.nasamreza.org
e6b8fa5707 SELECT ... INTO local_vars ...;
For Stored Procedures
2003-01-18 18:21:13 +02:00
pem@mysql.com
4b0adb203b Added the Stored Procedure tests.
Removed newly added, but now redundant, test file.
2003-01-17 14:38:05 +01:00