Commit graph

347 commits

Author SHA1 Message Date
pem@mysql.comhem.se
027c5a6dac Fixed BUG#8762: Stored Procedures: Inconsistent behavior
of DROP PROCEDURE IF EXISTS statement.
2005-03-02 17:25:58 +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
monty@mysql.com
d35140a851 First stage of table definition cache
Split TABLE to TABLE and TABLE_SHARE (TABLE_SHARE is still allocated as part of table, will be fixed soon)
Created Field::make_field() and made Field_num::make_field() to call this
Added 'TABLE_SHARE->db' that points to database name; Changed all usage of table_cache_key as database name to use this instead
Changed field->table_name to point to pointer to alias. This allows us to change alias for a table by just updating one pointer.
Renamed TABLE_SHARE->real_name to table_name
Renamed TABLE->table_name to alias
Renamed TABLE_LIST->real_name to table_name
2005-01-06 13:00:13 +02:00
monty@mysql.com
34d5331cee Merge with global tree 2004-12-31 00:50:30 +02:00
monty@mysql.com
d71c030587 After merge fixes 2004-12-31 00:44:00 +02:00
acurtis@pcgem.rdg.cyberkinetica.com
b1e30904d5 WL#925 - Privileges for stored routines
Implement fine-grained control over access to stored procedures
  Privileges are cached (same way as existing table/column privs)
2004-12-23 10:46:24 +00:00
ram@gw.mysql.r18.ru
f7fb35c518 A fix (Bug #6843: Wrong function name crashes MySQL if mysql.proc table is missi 2004-12-16 16:29:47 +04:00
bell@sanja.is.com.ua
69ec6a4592 Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-5.0
into sanja.is.com.ua:/home/bell/mysql/bk/work-join-5.0
2004-11-25 02:27:02 +02:00
bell@sanja.is.com.ua
1e3d8b0839 post-merge fix 2004-11-25 02:23:13 +02:00
pem@mysql.comhem.se
43aefd66fd Fix compiler warnings on some systems. (Unused variables)
Fixed bug in DROP FUNCTION for UDFs.
Note: It still doesn't work properly, but that bug is somewhere else.
2004-11-23 19:19:09 +01:00
bell@sanja.is.com.ua
072d38eb12 merge 2004-11-21 20:08:12 +02:00
bell@sanja.is.com.ua
7210195f1e now my_printf_error is not better then my_error, but my_error call is shorter
used only one implementation of format parser of (printf)
fixed multistatement
2004-11-13 19:35:51 +02:00
bell@sanja.is.com.ua
1555469b64 merge 2004-11-12 15:36:31 +02:00
bell@sanja.is.com.ua
31f7811183 post-review fixes 2004-11-12 14:34:00 +02:00
bell@sanja.is.com.ua
0ef0b030a5 merge 2004-11-11 21:18:10 +02:00
timour@mysql.com
e61b4454da Merge of WL#1972 "Evaluate HAVING before SELECT select-list" 2004-11-11 11:31:58 +02:00
monty@mysql.com
2bba55b57f After merge fixes
Added push_back(void *, MEM_ROOT *) to make some list-handling code easier that needs to be allocated in a different mem-root
(Before one had to change thd->mem_root ; push_back(); restore mem_root.
2004-11-09 03:58:44 +02:00
monty@mysql.com
47bbf768d4 Fixes after merge with 4.1
FOUND is not a reserved keyword anymore
Added Item_field::set_no_const_sub() to be able to mark fields that can't be substituted
Added 'simple_select' method to be able to quickly determinate if a select_result is a normal SELECT
Note that the 5.0 tree is not yet up to date: Sanja will have to fix multi-update-locks for this merge to be complete
2004-11-03 12:39:38 +02:00
timour@mysql.com
09f1c7096c WL#1972 "Evaluate HAVING before SELECT select-list"
- Changed name resolution for GROUP BY so that derived columns do not shadow table columns
  from the FROM clause. As a result GROUP BY now is handled as a true ANSI extentsion.
- Issue a warning when HAVING is resolved into ambiguous columns, and prefer the columns from
  the GROUP BY clause over SELECT columns.
2004-11-02 18:23:15 +02:00
bell@sanja.is.com.ua
dff05eb951 merge 2004-10-28 11:02:48 +03:00
pem@mysql.comhem.se
7944acbbfa Fixed BUG#6022: Stored procedure shutdown problem with self-calling function.
Fixed the pre-caching of functions. It now gives the expected stack overrun
  error for functions recursing too deep.
2004-10-23 13:30:05 +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
bell@sanja.is.com.ua
42d6d6765a Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-5.0
into sanja.is.com.ua:/home/bell/mysql/bk/work-error-5.0
2004-10-20 16:11:16 +03:00
bell@sanja.is.com.ua
4714a6e744 errors without code removed
net_printf/send_error calls replaced by my_error family functions
-1/1 (sent/unsent) error reporting removed
(WL#2133)
2004-10-20 04:04:37 +03:00
pem@mysql.comhem.se
4043c0f3db Implemented the stored procedure data access characteristics:
NO SQL
CONTAINS SQL (default)
READS SQL DATA
MODIFIES SQL DATA

These are needed as hints for the replication.
(Before this, we did have the default in the mysql.proc table, but no support in the parser.)
2004-10-14 18:07:09 +02:00
bell@sanja.is.com.ua
f797298fc5 fixed merged view fields names (BUG#5147)
support of merged VIEW over several tables added (WL#1809)
2004-09-14 19:28:29 +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
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
bell@sanja.is.com.ua
31dacc6ede Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-5.0
into sanja.is.com.ua:/home/bell/mysql/bk/work-5.0
2004-09-02 07:52:29 +03:00
bell@sanja.is.com.ua
56d8567a3d adding mysql.proc to table list if view contains stored procedures (BUG#5151) 2004-09-01 19:00:41 +03: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
7e1b622639 Fixed BUG#4934: Caching issue with stored procedures.
...and added new test file, sp-threads, for multiple connection tests
  (apart from the security tests that are in sp-security).
2004-08-06 18:11:14 +02:00
konstantin@mysql.com
e67584151e Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into mysql.com:/home/kostja/mysql/mysql-5.0-sap-new
2004-08-03 03:33:51 -07:00
konstantin@mysql.com
d3e520ce7e Port of cursors to be pushed into 5.0 tree:
- client side part is simple and may be considered stable
- server side part now just joggles with THD state to save execution
  state and has no additional locking wisdom.
  Lot's of it are to be rewritten.
2004-08-03 03:32:21 -07:00
pem@mysql.comhem.se
51eb64402a WL#2001: Optimize stored procedure code.
Added a simple optimizer that shortcuts jumps and skip unused instructions.
2004-08-02 18:05:31 +02:00
serg@serg.mylan
aa35efd292 after merge fixes 2004-07-22 00:26:33 +02:00
bell@sanja.is.com.ua
9336d36cf8 VIEW
two TABLE_LIST copy eliminated
2004-07-16 01:15:55 +03: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
monty@mysql.com
fa7f63d46d After merge fixes 2004-07-12 07:43:38 +03: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.com
7aa3207cb3 Merge mysql.com:/usr/local/bk/mysql-5.0
into mysql.com:/home/pem/work/mysql-5.0-merge
2004-06-09 14:44:44 +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
e3132d9a7c Fixed proper restoring of current db on errors.
This fixes part of BUG#3229: Stored procedure comment causes packets out of order.
2004-06-08 18:41:18 +02:00
monty@mysql.com
1d528a4d55 Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into mysql.com:/home/my/mysql-5.0
2004-05-11 12:21:38 +03: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
monty@mysql.com
d54b3f8d25 Merge with 5.0 2004-03-26 13:20:05 +02:00
monty@mysql.com
034a2f357f Speed up things if mysql.proc doesn't exists 2004-03-26 13:14:40 +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.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.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
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
pem@mysql.comhem.se
f9e73c7716 Post-merge fixes. 2004-02-11 18:21:55 +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
monty@mysql.com
26aae2abbb Fixed memory leaks in SP
Some code cleanup
2003-12-21 12:48:03 +02: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
7a1fddaa1f Renamed the "schema" column to "db" in mysql.proc to keep it in style with
all the other mysql.* tables.
2003-12-16 19:14:10 +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
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
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
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
055559bcaa Added more error handling for abnormal cases (like a broken mysql.proc table). 2003-10-30 10:25:45 +01:00
pem@mysql.comhem.se
70ea503662 Bugfix of previous WL#1265 commit.
Need a sp_cache_remove() function with implicit name lookup to make the WL task
to work. It's a cleaner and more convenient interface anyway...
2003-10-21 18:13:14 +02:00
pem@mysql.comhem.se
e42a724fa7 WL#1265: Fix proper ALTER/DROP support in the SP cache.
New sp_cache C API. When an SP is dropped, old caches (in other threads)
become invalid and are cleared.
Also, the caches in THD are only created on demand.
2003-10-21 12:08:35 +02:00
pem@mysql.telia.com
6e55a3428a Post-merge fixes. 2003-09-24 15:26:20 +02:00
pem@mysql.telia.com
b8e4dc03d8 Fix bug in sp.cc:db_find_routine() which made tables remain open in some cases. 2003-09-17 12:30:05 +02:00
pem@mysql.telia.com
a8a29a39d2 Merging 4.1 into 5.0 (second pass; post-merge fixes).
One test in subselect.test still wrong.
Had to reconstruct all errmsg.txt files completely, since auto-merge made
a mess of the lot. :-(
2003-07-09 17:07:12 +02:00
pem@mysql.com
c908b555ff Fixed the old kludge for pre-loading functions and made it more efficient
using a hash table instead (and made it work with lex pointers).
Some additional code cleanup too.
2003-07-07 14:55:10 +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
1d3c703d58 SP cache (WL#730). (Mostly by vva, additions by pem.) 2003-07-01 18:14:24 +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
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
pem@mysql.com
462430ba55 Post merge fixes. 2003-04-04 15:47:43 +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
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
9b6d015a85 ...and got rid of the strncasecmps too. 2003-03-27 17:47:25 +01:00
pem@mysql.com
ac44a5f66e Replaced a couple of strcasecmps. 2003-03-27 17:35:27 +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
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
02211a600b Post-merge fixes (adapting new SP code to 4.1 changes). 2003-02-18 19:58:03 +01:00
pem@mysql.com
d53fc31958 Fixed some DBUGing, and optimized SET slightly. 2003-02-12 16:17:03 +01:00
pem@mysql.com
f2d6ec9321 Some new stuff in the Docs/sp-* files, and renamed a few functions in preparation
for future work.
2003-02-04 17:40:18 +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