Commit graph

227 commits

Author SHA1 Message Date
unknown
33d5d4ad99 Fix for BUG#13095: Cannot create VIEWs in prepared statements
- allow CREATE VIEW as well as DROP VIEW to use in prepared statements;
  - fix CREATE VIEW implementation to make it work in prepared statements.


mysql-test/r/sp.result:
  Results file for the test case for BUG#13095.
mysql-test/t/sp.test:
  Test case for BUG#13095.
sql/sql_lex.h:
  Added a variable to remember start of whole CREATE VIEW statement
  as well as start of its SELECT part.
sql/sql_prepare.cc:
  Allow CREATE VIEW and DROP VIEW to use in prepared statements.
sql/sql_view.cc:
  Use stored start of whole CREATE VIEW statement instead of thd->query,
  which differs from the original when prepared statement is executing.
sql/sql_yacc.yy:
  Remember start of whole CREATE VIEW statement as well as start of its
  SELECT part.
2005-10-25 00:54:04 +04:00
unknown
a7f4882a43 Fixed BUG#13941: replace() string fuction behaves badly inside stored
procedure
  For some functions returning strings (like "replace" and "ifnull" - where
  val_str() is returning a pointer into one of the parameters) - we ended
  up with a dangling pointer after the new operator destroyed the reuse item
  in the eval function.
  A working, if not very elegant, solution is to simply copy the string in
  such cases.


mysql-test/r/sp.result:
  New test case for BUG#13941.
mysql-test/t/sp.test:
  New test case for BUG#13941.
sql/sp_head.cc:
  Copy the string when evaluating some string functions (e.g. "replace" and "ifnull")
  to avoid using a dangling pointer.
2005-10-19 14:54:54 +02:00
unknown
ad45b9a1d5 Merge mysql.com:/usr/local/bk/mysql-5.0
into  mysql.com:/home/pem/work/bug7049/mysql-5.0


mysql-test/r/sp.result:
  Auto merged
mysql-test/t/sp.test:
  Auto merged
sql/mysqld.cc:
  Auto merged
sql/sp_head.cc:
  Auto merged
2005-10-17 15:12:38 +02:00
unknown
ccb796a9ce sp-security.result, sp.result, sp-security.test, sp.test:
Test for bug#12812 moved from sp.test to sp-security.test


mysql-test/t/sp.test:
  Test for bug#12812 moved from sp.test to sp-security.test
mysql-test/t/sp-security.test:
  Test for bug#12812 moved from sp.test to sp-security.test
mysql-test/r/sp.result:
  Test for bug#12812 moved from sp.test to sp-security.test
mysql-test/r/sp-security.result:
  Test for bug#12812 moved from sp.test to sp-security.test
2005-10-16 22:47:19 +04:00
unknown
60e411eb32 type_binary.result, type_binary.test:
new file
mysql_fix_privilege_tables.sql, mysql_create_system_tables.sh:
  Adding true BINARY/VARBINARY: fixing "password" type, not to be 0x00-padding.
Many files:
  Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes.
  Adding true BINARY/VARBINARY: new pad_char structure member.
ctype-bin.c:
  Adding true BINARY/VARBINARY: new pad_char structure member.
  New strnxfrm, with two trailing length bytes.
field.cc:
  Adding true BINARY/VARBINARY.


sql/field.cc:
  Adding true BINARY/VARBINARY.
strings/ctype-big5.c:
  Adding true BINARY/VARBINARY: new pad_char structure member.
strings/ctype-bin.c:
  Adding true BINARY/VARBINARY: new pad_char structure member.
  New strnxfrm, with two trailing length bytes.
strings/ctype-cp932.c:
  Adding true BINARY/VARBINARY: new pad_char structure member.
strings/ctype-czech.c:
  Adding true BINARY/VARBINARY: new pad_char structure member.
strings/ctype-euc_kr.c:
  Adding true BINARY/VARBINARY: new pad_char structure member.
strings/ctype-eucjpms.c:
  Adding true BINARY/VARBINARY: new pad_char structure member.
strings/ctype-extra.c:
  Adding true BINARY/VARBINARY: new pad_char structure member.
strings/ctype-gb2312.c:
  Adding true BINARY/VARBINARY: new pad_char structure member.
strings/ctype-gbk.c:
  Adding true BINARY/VARBINARY: new pad_char structure member.
strings/ctype-latin1.c:
  Adding true BINARY/VARBINARY: new pad_char structure member.
strings/ctype-simple.c:
  Adding true BINARY/VARBINARY: new pad_char structure member.
strings/ctype-sjis.c:
  Adding true BINARY/VARBINARY: new pad_char structure member.
strings/ctype-tis620.c:
  Adding true BINARY/VARBINARY: new pad_char structure member.
strings/ctype-uca.c:
  Adding true BINARY/VARBINARY: new pad_char structure member.
strings/ctype-ucs2.c:
  Adding true BINARY/VARBINARY: new pad_char structure member.
strings/ctype-ujis.c:
  Adding true BINARY/VARBINARY: new pad_char structure member.
strings/ctype-utf8.c:
  Adding true BINARY/VARBINARY: new pad_char structure member.
strings/ctype-win1250ch.c:
  Adding true BINARY/VARBINARY: new pad_char structure member.
include/m_ctype.h:
  Adding true BINARY/VARBINARY: new pad_char structure member.
mysql-test/t/alter_table.test:
  Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes.
mysql-test/t/binary.test:
  Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes.
mysql-test/t/cast.test:
  Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes.
mysql-test/t/ctype_cp1251.test:
  Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes.
mysql-test/t/ctype_many.test:
  Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes.
mysql-test/t/federated.test:
  Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes.
mysql-test/t/func_in.test:
  Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes.
mysql-test/t/ndb_condition_pushdown.test:
  Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes.
mysql-test/t/ndb_types.test:
  Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes.
mysql-test/t/sp.test:
  Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes.
mysql-test/t/type_blob.test:
  Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes.
mysql-test/r/alter_table.result:
  Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes.
mysql-test/r/binary.result:
  Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes.
mysql-test/r/cast.result:
  Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes.
mysql-test/r/ctype_cp1251.result:
  Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes.
mysql-test/r/ctype_many.result:
  Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes.
mysql-test/r/federated.result:
  Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes.
mysql-test/r/func_in.result:
  Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes.
mysql-test/r/ndb_condition_pushdown.result:
  Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes.
mysql-test/r/ndb_types.result:
  Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes.
mysql-test/r/sp.result:
  Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes.
mysql-test/r/system_mysql_db.result:
  Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes.
mysql-test/r/type_blob.result:
  Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes.
scripts/mysql_create_system_tables.sh:
  Adding true BINARY/VARBINARY: fixing "password" type, not to be 0x00-padding.
scripts/mysql_fix_privilege_tables.sql:
  Adding true BINARY/VARBINARY: fixing "password" type, not to be 0x00-padding.
2005-10-13 19:16:19 +05:00
unknown
9b74b04671 Merge mysql.com:/usr/local/bk/mysql-5.0
into  mysql.com:/home/pem/work/mysql-5.0


mysql-test/r/sp.result:
  This will be regenerated...
mysql-test/t/sp.test:
  Manual merge.
2005-09-29 16:59:25 +02:00
unknown
06eabeeea8 Fixed BUG#12589: Assert when creating temp. table from decimal stored
procedure variable
  Second version, after review.
  Keep the unsigned_flag in Item_decimal updated. Note that this also changed
  the result of several old test results - creating tables from decimal
  templates now gives unsigned columns and different sizes. (Several tests
  had Length > Max_length before.)


mysql-test/r/case.result:
  Updated result (after fixing BUG#12589).
mysql-test/r/metadata.result:
  Updated result (after fixing BUG#12589).
mysql-test/r/ps_2myisam.result:
  Updated result (after fixing BUG#12589).
mysql-test/r/ps_3innodb.result:
  Updated result (after fixing BUG#12589).
mysql-test/r/ps_4heap.result:
  Updated result (after fixing BUG#12589).
mysql-test/r/ps_5merge.result:
  Updated result (after fixing BUG#12589).
mysql-test/r/ps_6bdb.result:
  Updated result (after fixing BUG#12589).
mysql-test/r/ps_7ndb.result:
  Updated result (after fixing BUG#12589).
mysql-test/r/sp.result:
  New test case for BUG#12589.
mysql-test/r/type_newdecimal.result:
  Updated result (after fixing BUG#12589).
mysql-test/t/sp.test:
  New test case for BUG#12589.
sql/item.cc:
  Keep the unsigned_flag updated in Item_splocal and Item_decimal.
2005-09-27 17:07:28 +02:00
unknown
a5925a90e2 Fixed BUG#7049: Stored procedure CALL errors are ignored
Search the chain of sp_rcontexts recursively for handlers. If one is found,
  it will be detected in the sp_head::execute() method at the corresponding
  level.


mysql-test/r/sp.result:
  New test case for BUG#7049.
  Note that the spurious warnings in the BUG#12379 test now are gone (as expected).
mysql-test/t/sp.test:
  New test case for BUG#7049.
sql/sp_head.cc:
  Link sp_rcontexts to allow catching errors across invokation boundaries.
  (Also fixed print method for the hreturn instruction.)
sql/sp_rcontext.cc:
  Link sp_rcontexts to allow catching errors across invokation boundaries.
  If a handler is not found in the current sp_rcontext, recurse into the previous ones (if any).
sql/sp_rcontext.h:
  Link sp_rcontexts to allow catching errors across invokation boundaries.
2005-09-26 18:46:31 +02:00
unknown
ad8ff14165 Fixed BUG#6127: Stored procedure handlers within handlers don't work
Replaced the dumb in-handler/not-in-handler check with a proper recursion
    check of handlers being executed.
    (Re-commit in a different tree, to make push possible.)


mysql-test/r/sp.result:
  New test case for BUG#6127.
mysql-test/t/sp.test:
  New test case for BUG#6127.
sql/sp_head.cc:
  Replaced the setting of ctx->in_handler with a enter/exit handler methods.
sql/sp_rcontext.cc:
  Replaced the boolean in_handler flag with a stack of handlers being exectuted, for proper recursion check.
sql/sp_rcontext.h:
  Replaced the boolean in_handler flag with a stack of handlers being exectuted, for proper recursion check.
  (And added some comments in the sp_rcontext class.)
2005-09-26 18:22:00 +02:00
unknown
7a47331f7d Manual merge
sql/item_func.cc:
  Auto merged
2005-09-20 03:31:00 +04:00
unknown
43dd29dfaa Fix bug #12812 create view calling a function works without execute right on function
Execution rigths on function was checked just before function execution,
thus it was unknown on prepare stage whether user have right to execute 
particular function.

Added access rights checking function which is called right after fixing
Item_func_sp.
This have additional effect that if user don't have rights for execution
query will fail on earlier stage and will not waste resources on optimizing
with failing on execution stage.


sql/item_func.h:
  Fix bug#12812 create view calling a function works without execute right on function
sql/item_func.cc:
  Fix bug#12812 create view calling a function works without execute right on function
  Added function Item_func_sp::check_access() which checks access rights.
  Added function Item_func_sp::fix_field() which calls check_access() after fixing.
  Item_func_sp::execute() now calls to check_access() to check access rights.
mysql-test/t/sp.test:
  Test case for bug#12812 create view calling a function works without execute right on function
mysql-test/r/sp.result:
  Test case for bug#12812 create view calling a function works without execute right on function
2005-09-20 03:05:35 +04:00
unknown
0b318fd64f Merge pchardin@bk-internal.mysql.com:/home/bk/mysql-5.0
into  mysql.com:/home/cps/mysql/trees/mysql-5.0-virgin


mysql-test/r/sp.result:
  Auto merged
mysql-test/t/sp.test:
  Auto merged
2005-09-14 14:54:48 +04:00
unknown
8c86f8e4bf Post-review fix for BUG#12712: SET AUTOCOMMIT should fail within SP/functions/triggers
mysql-test/r/sp.result:
  Added missing drop table.
mysql-test/t/sp.test:
  Added missing drop table.
sql/sp_head.h:
  Post-review fix for autocommit check in SPs and triggers.
sql/sql_yacc.yy:
  Post-review fix for autocommit check in SPs and triggers.
2005-09-14 10:54:02 +02:00
unknown
685173664a fix for Bug #12979 Stored procedures: crash if inout decimal parameter
mysql-test/r/sp.result:
  fix result
mysql-test/r/type_newdecimal.result:
  fix result
mysql-test/t/sp.test:
  add a test for the bug
mysql-test/t/type_newdecimal.test:
  add a test for the bug
sql/item_func.cc:
  call correct method of the item
2005-09-14 07:25:32 +04:00
unknown
d1bc788ed1 after-merge fix 2005-09-13 19:59:26 +04:00
unknown
3a1801b49b Merge pchardin@bk-internal.mysql.com:/home/bk/mysql-5.0
into  mysql.com:/home/cps/mysql/trees/mysql-5.0-virgin


mysql-test/t/sp.test:
  Auto merged
mysql-test/r/sp.result:
  SCCS merged
2005-09-13 18:54:47 +04:00
unknown
b6aba9db70 Fixed BUG#12379: PROCEDURE with HANDLER calling FUNCTION with error
get strange result
  according to Monty's suggestions, fixing the SELECT behaviour on errors
  with SP handlers. Note that some warnings from SELECT still shows up when
  the handler has caught - this is an effect of another known bug (BUG#7049).


mysql-test/r/sp.result:
  New test cases for BUG#12379.
mysql-test/t/sp.test:
  New test cases for BUG#12379.
sql/sql_class.cc:
  Abort selects on errors more graceful with SP handlers.
sql/sql_class.h:
  Abort selects on errors more graceful with SP handlers.
2005-09-13 15:32:42 +02:00
unknown
7f70f599c3 Merge pchardin@bk-internal.mysql.com:/home/bk/mysql-5.0
into  mysql.com:/home/cps/mysql/trees/mysql-5.0


mysql-test/r/sp.result:
  manual merge
mysql-test/t/sp.test:
  manual merge
2005-09-13 17:05:17 +04:00
unknown
dd51642361 Fix for Bug #13124 Stored Procedure using SELECT INTO crashes server
mysql-test/r/sp.result:
  added a test
mysql-test/t/sp.test:
  corrected result file
sql/item.cc:
  check for NULL value before copying string
2005-09-13 15:15:38 +04:00
unknown
902932a1e8 Fixed BUG#13133: Local variables in stored procedures are not initialized correctly.
Have to init. all local variables in their frames, not just once at the beginning
  of invocation.


mysql-test/r/sp.result:
  New test case for BUG#13133.
mysql-test/t/sp.test:
  New test case for BUG#13133.
sql/sp_head.cc:
  Just init. local variable slots in the fram to NULL. (Real init. will be done
  in each block.)
sql/sp_pcontext.cc:
  Removed isset flag, since it's not used.
sql/sp_pcontext.h:
  Removed isset flag, since it's not used.
sql/sql_yacc.yy:
  Initialize local variables in the block to null, or the default value, given.
  (Untabifed block too.)
2005-09-13 12:50:21 +02:00
unknown
5ed7e97310 Merge spetrunia@bk-internal.mysql.com:/home/bk/mysql-5.0
into mysql.com:/home/psergey/mysql-5.0-bug12943


mysql-test/r/sp.result:
  Auto merged
mysql-test/t/sp.test:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/sp_head.cc:
  Auto merged
sql/sql_parse.cc:
  Auto merged
2005-09-09 10:08:46 +04:00
unknown
1b15f430d6 fix for Bug #12849 Stored Procedure: Crash on procedure call with CHAR type 'INOUT' parameter
(recommit with the right Bug#)


mysql-test/r/sp.result:
  result file modified to reflect new test
mysql-test/t/sp.test:
  added test for the bug
sql/item.cc:
  protect Item_splocal value from modification by CONCAT() et al
sql/item.h:
  added a buffer to save Item_splocal string pointer
sql/sp_head.cc:
  don't employ reuse mechanism to save var into itself
2005-09-08 18:25:42 +02:00
unknown
eb769e54b8 Fix for BUG#12637: Make SPs+user variables replication work:
* Allocate thd->user_var_events elements on appropriate mem_root
* If several SP statements are binlogged as a single statement, collect all user var
  accesses they make (grep for StoredRoutinesBinlogging for details)


mysql-test/r/rpl_sp_effects.result:
  Testcase for BUG#12637
mysql-test/r/sp.result:
  re-enabled test case for BUG#12297
mysql-test/t/rpl_sp_effects.test:
  Testcase for BUG#12637
mysql-test/t/sp.test:
  re-enabled test case for BUG#12297
sql/item_func.cc:
  Fix for BUG#12637: Make SPs+user variables replication work:
  * Allocate thd->user_var_events elements on appropriate mem_root
  * If several SP statements are binlogged as a single statement, collect all user var
    accesses they make.
sql/log.cc:
  Fix for BUG#12637: Make SPs+user variables replication work:
  * Allocate thd->user_var_events elements on appropriate mem_root
  * If several SP statements are binlogged as a single statement, collect all user var
    accesses they make.
sql/sp_head.cc:
  Fix for BUG#12637: Make SPs+user variables replication work:
  * Allocate thd->user_var_events elements on appropriate mem_root
  * If several SP statements are binlogged as a single statement, collect all user var
    accesses they make.
sql/sp_head.h:
  Remove compiler warning.
sql/sql_class.h:
  Fix for BUG#12637: Make SPs+user variables replication work.
sql/sql_parse.cc:
  Fix for BUG#12637: Make SPs+user variables replication work.
2005-09-07 19:39:47 +04:00
unknown
a2d8ab0bb5 Fix for spelling miss and eol junk
client/mysqltest.c:
  Fix spelling error
mysql-test/t/information_schema.test:
  Eol junk detected, added #
mysql-test/t/rpl_slave_status.test:
  Missing ;
mysql-test/t/sp.test:
  Eol junk detected, added #
mysql-test/t/view.test:
  Eol junk detected, added #
2005-09-01 20:02:08 +02:00
unknown
bddf61cfb3 Bug#9048
"Creating a function with char binary IN parameter fails"
  Parse BINARY as part of type declaration, not as 
  a column attribute.


mysql-test/r/sp.result:
  test for bug 9048
mysql-test/t/sp.test:
  test for bug 9048
sql/sql_yacc.yy:
  fix bug 9048
  parse BINARY as part of type declaration and not as column modifier.
2005-08-27 07:26:14 +01:00
unknown
da7a46ad9f Merge pchardin@bk-internal.mysql.com:/home/bk/mysql-5.0
into  mysql.com:/home/cps/mysql/devel/mysql-5.0-sp11333


mysql-test/r/sp.result:
  Auto merged
mysql-test/t/sp.test:
  Auto merged
sql/item.cc:
  Auto merged
sql/item.h:
  Auto merged
sql/sp_head.cc:
  manual merge
2005-08-25 16:06:49 +04:00
unknown
d29df5645b Fix Bug#11333 "Stored Procedure: Memory blow up on repeated SELECT ... INTO query"
mysql-test/r/sp.result:
  update result
mysql-test/t/sp.test:
  Add test for Bug #11333 "Stored Procedure: Memory blow up on repeated SELECT ... INTO query"
sql/item.cc:
  we should call destructors for Items before reuse
sql/item.h:
  Add new method and constructor for Item_string.
sql/sp_head.cc:
  String allocation should be done on the system heap for now.
2005-08-25 15:34:14 +04:00
unknown
0183ec75e1 fix test for a bug to use correct tables
mysql-test/r/sp.result:
  fix result
mysql-test/t/sp.test:
  fix test for a bug: tests in sp.test should reuse tables t1 and t2 and create/drop tables t3, t4 etc.
  So, tables t1 and t2 were renamed into t3 and t4
2005-08-24 12:25:57 +04:00
unknown
276bd123b7 A fix and a test case for "Bug #12168 'DECLARE CONTINUE HANDLER FOR
NOT FOUND ...' in conditional handled incorrectly".

Whenever we remove an instruction during optimization, we need to
adjust instruction numbers (ip - instruction pointer) stored in all
instructions. In addition to that, sp_instr_hpush_jump, which 
corresponds to DECLARE CONTINUE HANDLER needs adjustment for m_handler,
which holds the number of instruction with the continue handler.
In the bug report, a wrong ip stored in m_handler was pointing at 
FETCH, which resulted in an error message and abnormal SP termination.
The fix is to just remove m_handler member from sp_instr_hpush_jump,
as it's always points to the instruction next to the DECLARE
statement itself (m_ip+1).


mysql-test/r/sp.result:
  Test results fixed (Bug#12168)
mysql-test/t/sp.test:
  A test case for Bug#12168 "'DECLARE CONTINUE HANDLER FOR NOT
  FOUND ...' in conditional handled incorrectly"
sql/sp_head.cc:
  Remove m_handler (the number of continue handler instruction)
  as it always equal to m_ip+1
sql/sp_head.h:
  Remove m_handler (the number of continue handler instruction)
  as it always equal to m_ip+1
2005-08-19 17:03:21 +04:00
unknown
fa19a9f246 Fix for Bug#11247 Stored procedures: Function calls in long loops leak memory
and Bug#12297 SP crashes the server if data inserted inside a lon loop
Third commit attempt. With fixes to the issues, showed up after full rebuild and
tests on other hosts.


mysql-test/r/rpl_sp.result:
  New warnings appeared in result file, as now we always create spcont in a stored routine.
  This is correct behaviour. We swallowed some warnings, as we used thd->spcont to check whether
  we are in the SP though we didn't set spcont in certain cases. This is fixed now.
mysql-test/r/sp.result:
  fixed result file to reflect new tests
mysql-test/t/sp.test:
  Added tests for bugs. Though one of them is disabled, as it fails because of the other bug.
  It should be enabled, when bug 12297 is fixed.
sql/sp_head.cc:
  Per-instruction arena is implemented
sql/sp_rcontext.cc:
   Now we should deal with callers_arena->free_list when we employ reuse mechanism with callers_arena
   switched during sp_eval_func_item
sql/sp_rcontext.h:
  Add new member to sp_rcontext class, in order to handle instructions with assignment
  and/or with nested SP processing properly.
2005-08-18 11:23:54 +02:00
unknown
d620954a67 Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  mysql.com:/home/my/mysql-5.0


mysql-test/t/sp.test:
  Auto merged
sql/sp_head.cc:
  Auto merged
sql/sql_base.cc:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sp_cache.cc:
  manual merge
2005-08-11 16:43:22 +03:00
unknown
d83f690851 Cleanups during review of new code
mysql-test/t/sp.test:
  Use --disable_parsing instead of comments
sql/lock.cc:
  Remove compiler warning
sql/mysqld.cc:
  Always send valid flag argument to reload_acl_and_cache()
sql/sp_cache.cc:
  Simple optimization
  Don't use mutex to read 'long' variable
  Indentation fixes
sql/sp_head.cc:
  Fix comments to use /* */
  Set proc_info to 0 after close_thread_tables()
sql/sql_base.cc:
  remove not needed test
sql/sql_parse.cc:
  Always send valid flag argument to reload_acl_and_cache()
  Fixed indentation
  Ensure we get an error if reset_master() fails.
2005-08-11 15:58:15 +03:00
unknown
8103db27bb Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  mysql.com:/home/dlenev/src/mysql-5.0-is


mysql-test/r/information_schema.result:
  Auto merged
mysql-test/t/information_schema.test:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/sp.cc:
  Auto merged
sql/sp.h:
  Auto merged
sql/sql_base.cc:
  Auto merged
sql/sql_class.cc:
  Auto merged
sql/sql_prepare.cc:
  Auto merged
sql/sql_show.cc:
  Auto merged
mysql-test/r/sp.result:
  Manual merge
mysql-test/t/sp.test:
  Manual merge
sql/sql_class.h:
  Manual merge
2005-08-09 11:43:55 +04:00
unknown
c4187de67a Merge mysql.com:/home/jimw/my/mysql-5.0-11570
into  mysql.com:/home/jimw/my/mysql-5.0-clean


mysql-test/t/sp.test:
  Auto merged
2005-08-08 11:43:07 -07:00
unknown
39fda60043 Fix for bug #10055 "Using stored function with information_schema causes empty
result set".

To enable full access to contents of I_S tables from stored functions
or statements that use them, we manipulate with thread's open tables
state and ensure that we won't cause deadlock when we open tables by
ignoring flushes and name-locks.
Building of contents of I_S.TABLES no longer requires locking of tables
since we use use handler::info() method with HA_STATUS_AUTO flag instead
of handler::update_auto_increment() for obtaining information about
auto-increment values. But this also means that handlers have to implement
support for HA_STATUS_AUTO flag (particularly InnoDB needs it).


mysql-test/r/alter_table.result:
  Updated test results. This change was caused by the fact that now when
  we build contents of I_S tables (and thus output of SHOW INDEX) we
  don't use instances of tables which may be already opened and locked
  by thread (we always use new instance).
mysql-test/r/information_schema.result:
  Added test which checks how information about current auto-increment value for
  table is reported in INFORMATION_SCHEMA.TABLES view.
mysql-test/r/sp.result:
  Added test for bug #10055 "Using stored function with information_schema causes
  empty result set".
mysql-test/t/information_schema.test:
  Added test which checks how information about current auto-increment value for
  table is reported in INFORMATION_SCHEMA.TABLES view.
mysql-test/t/sp.test:
  Added test for bug #10055 "Using stored function with information_schema causes
  empty result set".
sql/mysql_priv.h:
  close_thread_tables():
    Get rid of 'stopper' argument which is no longer used. Now when we need
    to open and then close some table without touching tables which are already
    opened we use THD::reset_n/restore_backup_open_tables_state() methods.
  open_tables()/open_normal_and_derived_tables():
    Added 'flags' argument to be able open tables even if some has done
    a flush or hold namelock on them.
sql/sp.cc:
  close_proc_table/open_proc_table_for_read/db_find_routine():
    Replaced push_open_tables_state/pop_open_tables_state() methods which
    were saving/restoring current open tables state in/from THD::open_state_list
    with reset_n_backup_open_tables_state/restore_backup_open_tables_state()
    methods which assume that backup storage for this state is allocated on
    stack (or elsewhere) by their caller.
  open_proc_table_for_read():
    Since now we can have several open tables states stacked up we can't rely
    rely on checking whether we have some tables open in previous state.
    Instead we always assume that some tables are open and we need to ignore
    flush while locking mysql.proc. We don't really need 
    MYSQL_LOCK_IGNORE_GLOBAL_READ_LOCK in this case since we open mysql.proc table
    only for reading.
sql/sp.h:
  Added declarations of open_proc_table_for_read()/close_proc_table() to be
  able to use them in sql_show.cc.
sql/sql_base.cc:
  close_thread_tables():
    Get rid of 'stopper' argument which is no longer used. Now when we need
    to open and then close some table without touching tables which are already
    opened we use THD::reset_n/restore_backup_open_tables_state() methods.
  open_tables()/open_normal_and_derived_tables():
    Added 'flags' argument to be able open tables even if some has done
    a flush or hold namelock on them.
sql/sql_class.cc:
  Open_tables_state, THD:
    Replaced push_open_tables_state/pop_open_tables_state() methods which
    were saving/restoring current open tables state in/from THD::open_state_list
    with reset_n_backup_open_tables_state/restore_backup_open_tables_state()
    methods which assume that backup storage for this state is allocated on
    stack (or elsewhere) by their caller.
sql/sql_class.h:
  Open_tables_state, THD:
    Replaced push_open_tables_state/pop_open_tables_state() methods which
    were saving/restoring current open tables state in/from THD::open_state_list
    with reset_n_backup_open_tables_state/restore_backup_open_tables_state()
    methods which assume that backup storage for this state is allocated on
    stack (or elsewhere) by their caller.
sql/sql_handler.cc:
  open_tables()/open_normal_and_derived_tables():
    Added 'flags' argument to be able open tables even if some has done
    a flush or hold namelock on them.
sql/sql_prepare.cc:
  open_tables()/open_normal_and_derived_tables():
    Added 'flags' argument to be able open tables even if some has done
    a flush or hold namelock on them.
sql/sql_show.cc:
  get_all_tables():
    Now we use THD::reset_n_/restore_backup_open_tables_state() for 
    saving/restoring open tables state instead of working with it directly
    (This also allows us to have proper content of I_S system tables in
    statements with stored functions and in stored functions). We also
    ignore possible flushes when opening tables (we may create deadlock
    otherwise). Also we do all needed manipulations with LEX in this function
    and not in get_schema_tables_result() now.
  get_schema_tables_record():
    Let us use handler::info() method with HA_STATUS_AUTO flag for obtaining
    information about table's auto-increment value. This allows to avoid locking
    of tables which is needed when we use handler::update_auto_increment() method.
  fill_schema_proc():
    Now we use open_proc_table_for_read/close_proc_table() for access to
    mysql.proc table (so we won't cause deadlock if we already have some
    tables open and locked, this also allows us to have proper content in
    ROUTINES system table in statements using stored functions/in stored
    functions).
  get_schema_tables_result():
    Moved all manipulations with Open_tables_state and LEX needed for
    safe opening of tables to ST_SCHEMA_TABLE::fill_table functions
    (i.e. get_all_tables() and fill_schema_proc()).
sql/sql_update.cc:
  open_tables()/open_normal_and_derived_tables():
    Added 'flags' argument to be able open tables even if some has done
    a flush or hold namelock on them.
2005-08-08 17:46:06 +04:00
unknown
e442059c0d Manual merge
mysql-test/r/sp.result:
  Auto merged
mysql-test/r/view.result:
  Auto merged
mysql-test/t/view.test:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/sp.cc:
  Auto merged
sql/sp_head.cc:
  Auto merged
sql/sp_head.h:
  Auto merged
sql/sql_base.cc:
  Auto merged
sql/sql_class.cc:
  Auto merged
sql/sql_class.h:
  Auto merged
sql/sql_lex.cc:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_trigger.h:
  Auto merged
2005-08-03 03:47:07 +00:00
unknown
b323667ffc Prelocking-free SPs, post-review fixes:
* Don't activate prelocking mode for evaluating procedure arguments when it is not necessary.
* Code structure simplification and cleanup.
* Cleanup in .test files


mysql-test/r/sp-prelocking.result:
  Prelocking-free SPs, post-review fixes:
  Added comment, s/testdb/mysqltest/, fixed a wrong test (error wasnt reported because of known bug in mysqltestrun)
mysql-test/r/sp-security.result:
  Don't drop the table we're not using.
mysql-test/r/sp.result:
  Prelocking-free SPs, post-review fixes:
  remove redundant "drop table if exists t3" statements
mysql-test/t/sp-prelocking.test:
  Prelocking-free SPs, post-review fixes:
  Added comment, s/testdb/mysqltest/, fixed a wrong test (error wasnt reported because of known bug in mysqltestrun)
mysql-test/t/sp-security.test:
  Don't drop the table we're not using.
mysql-test/t/sp.test:
  Prelocking-free SPs, post-review fixes:
  remove redundant "drop table if exists t3" statements
sql/sp.cc:
  New, better defined, sp_get_prelocking_info() function to get info about
    statement prelocking options
sql/sp.h:
  Prelocking-free SPs, post-review fixes: New, better defined, sp_get_prelocking_info() 
  function to get info about statement prelocking options
sql/sp_cache.h:
  Prelocking-free SPs, post-review fixes: Amended the comments
sql/sp_head.cc:
  Prelocking-free SPs, post-review fixes: Amend the comments, simplify the code that 
  attaches removes statement's prelocking tables.
sql/sql_base.cc:
  Prelocking-free SPs, post-review fixes:
  * Use a better defined sp_get_prelocking_info() function to get info about 
    statement prelocking options
  * Don't activate prelocked mode for evaluation of SP arguments that use tables 
    but don't need prelocking.
sql/sql_class.cc:
  Prelocking-free SPs, post-review fixes: Initialize THD members in the order they are declared.
2005-08-03 03:37:32 +00:00
unknown
e43a609600 Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  mishka.local:/home/my/mysql-5.0


mysql-test/t/sp.test:
  Auto merged
sql/set_var.cc:
  Auto merged
sql/sql_view.cc:
  Auto merged
client/client_priv.h:
  Simple merge
client/mysqldump.c:
  Simple merge
mysql-test/r/variables.result:
  Simple merge
mysql-test/t/variables.test:
  Simple merge
sql/sql_trigger.cc:
  Simple merge
2005-07-31 12:56:02 +03:00
unknown
6b3478ec12 Fixes during review of new pushed code
Change bool in C code to my_bool
Added to mysqltest --enable_parsning and --disable_parsing to avoid to have to comment parts of tests
Added comparison of LEX_STRING's and use this to compare file types for view and trigger files.


client/client_priv.h:
  Added OPT_TRIGGERS (to get rid of compiler warning)
client/mysql.cc:
  Added cast to get rid of compiler warning
client/mysqldump.c:
  Added OPT_TRIGGERS (to get rid of compiler warning)
  Abort if we can't write to outfile (even if --ignore-errors is given)
client/mysqltest.c:
  Added --enable_parsning and --disable_parsing to avoid to have to comment parts of tests
include/my_sys.h:
  Make my_progname const
include/my_time.h:
  Avoid using 'bool' in C programs
mysql-test/lib/init_db.sql:
  Align with mysql_create_system_tables
  (Ideally this file should be auto-generated from the above script)
mysql-test/r/mysqltest.result:
  Test for --enable_parsing
mysql-test/r/variables.result:
  Update results after fix for overflow checking of max_heap_table_size
mysql-test/t/information_schema.test:
  USe --enable/disable parsing instead of comments
mysql-test/t/mysqltest.test:
  Test for --enable_parsing
mysql-test/t/sp.test:
  USe --enable/disable parsing instead of comments
mysql-test/t/variables.test:
  Portability fix for 64 bit systems
mysql-test/t/view.test:
  USe --enable/disable parsing instead of comments
mysys/my_init.c:
  May my_progname const
mysys/my_static.c:
  May my_progname const
mysys/thr_lock.c:
  Remove not needed casts
sql-common/my_time.c:
  Change bool -> my_bool as bool is not portable in C programs
sql/field.cc:
  Test number_to_datetime() for -1 instead of < 0 (Safety fix)
  New prototype for TIME_to_timestamp()
sql/item.h:
  Don't have prototypes for both uint32 and ulong as these 'may' be the same thing
sql/item_timefunc.cc:
  New prototype for TIME_to_timestamp()
sql/log.cc:
  Remove compiler warnings
sql/mysql_priv.h:
  New prototype for TIME_to_timestamp()
  Added function for comparing LEX_STRING
sql/set_var.cc:
  Added overflow checking when setting ulong variable
sql/sql_base.cc:
  Added function is_equal()
  Changed strncmp -> is_equal() as strncmp() to not match "V" (instead of "VIEW")
sql/sql_class.cc:
  Added comment
sql/sql_select.cc:
  Portability fixes
  After review fixes
sql/sql_trigger.cc:
  Use 'tables_alias_charset' for comparing database name
  Use 'is_equal()' to compare file type. (Old code didn't do the comparison correctly)
sql/sql_view.cc:
  Use 'is_equal()' to compare file type. (Old code didn't do the comparison correctly)
sql/time.cc:
  New prototype for TIME_to_timestamp() to allow easyer mapping to C function
sql/tztime.cc:
  bool -> my_bool (to allow calling C code from C++ code)
sql/tztime.h:
  bool -> my_bool (to allow calling C code from C++ code)
2005-07-31 12:49:55 +03:00
unknown
11abe15eab Added Non-prelocked SP execution: Now a PROCEDURE doesn't enter/leave prelocked mode for
its body, but lets each statement to get/release its own locks. This allows a broader set
of statements to be executed inside PROCEDUREs (but breaks replication)
This patch should fix BUG#8072, BUG#8766, BUG#9563, BUG#11126


mysql-test/r/sp-security.result:
  Drop tables this test attempts to create
mysql-test/r/sp-threads.result:
  Update test results
mysql-test/r/sp.result:
  Disabled a test that triggers BUG#11986, cleanup used tables when tests start.
mysql-test/r/view.result:
  Enabled a test case that now works with prelocking-free SPs
mysql-test/t/sp-security.test:
  Drop tables this test attempts to create
mysql-test/t/sp.test:
  Disabled a test that triggers BUG#11986, cleanup used tables when tests start.
mysql-test/t/view.test:
  Enabled a test case that now works with prelocking-free SPs
sql/handler.cc:
  Rename: thd->transaction.in_sub_stmt -> thd->in_sub_stmt
sql/item_func.cc:
  Rename: thd->transaction.in_sub_stmt -> thd->in_sub_stmt
sql/sp.cc:
  Non-prelocked SP execution: Added support for skipping prelocking of procedure body for
  "CALL proc(...)" statements.
sql/sp.h:
  Non-prelocked SP execution: Added support for skipping prelocking of procedure body for
  "CALL proc(...)" statements.
sql/sp_cache.h:
  Added comments
sql/sp_head.cc:
  Non-prelocked SP execution:
  * Try to unlock tables after PROCEDURE arguments have been evaluated.
  * Make sp_lex_keeper be able to execute in 2 modes: A) when already in prelocked mode
    B) when its statement enters/leaves prelocked mode itself.
sql/sp_head.h:
  Non-prelocked SP execution:  Make sp_lex_keeper to additionally keep list of tables it 
  needs to prelock when its statement enters/leaves prelocked mode on its own.
sql/sql_base.cc:
  Non-prelocked SP execution: Make open_tables() to
   * detect 'CALL proc(...)' and not to do prelocking for procedure body statements.
   * Make lex->query_tables_last to point precisely to a boundary in lex->query_tables 
     list where 'own' tables and views' tables end and added-for-prelocking tables begin.
     (it was not true before - view's tables could end up after query_tables_own_last)
sql/sql_class.cc:
  Rename: thd->transaction.in_sub_stmt -> thd->in_sub_stmt
sql/sql_class.h:
  Rename: thd->transaction.in_sub_stmt -> thd->in_sub_stmt
sql/sql_lex.cc:
  Non-prelocked SP execution: More rigourous cleanup in st_lex::cleanup_after_one_table_open()
sql/sql_parse.cc:
  Rename: thd->transaction.in_sub_stmt -> thd->in_sub_stmt, remove outdated comments
sql/sql_trigger.h:
  Rename: thd->transaction.in_sub_stmt -> thd->in_sub_stmt
2005-07-30 08:19:57 +00:00
unknown
675c4bb48c Added sql_mode saving to mysql_dump (BUG#5891, part 2)
client/client_priv.h:
  add OPT_ for --trigger parameter
client/mysqldump.c:
  fixed short simbol for trigger
  fixed lines break for more compiler compatibility
  added sql_mode output
  added comments
  made protection of trigger and view restoring commands from execution by old versions of mysql
mysql-test/r/mysqldump.result:
  changed test, to test sql_mode
mysql-test/r/sp.result:
  now sql_mode preserved in SP
mysql-test/t/mysqldump.test:
  changed test, to test sql_mode
mysql-test/t/sp.test:
  now sql_mode preserved in SP
sql/set_var.cc:
  fixed comment
2005-07-29 23:39:08 +03:00
unknown
0c17b6ed37 fix for bug#8692
mysql-test/r/sp.result:
  added expected result for bug #8692
mysql-test/t/sp.test:
  added testcase for bug #8692
sql/protocol_cursor.cc:
  fixed detecting of null fields: A field contains a null value only 
  if length is NULL_LENGTH
2005-07-22 08:11:23 +02:00
unknown
3815b5ad44 Replace host column when testing 'SHOW PROCESSLIST' since it is
different on Windows. (Bug #11570)


mysql-test/t/sp-threads.test:
  Replace host column to avoid spurious error on Windows
mysql-test/t/sp.test:
  Replace host column to avoid spurious error on Windows
2005-07-21 18:32:57 -07:00
unknown
7bdc4dd0a1 After-merge fixes (4.1 -> 5.0).
mysql-test/r/sp.result:
  Test results fixed: rewritten test for Bug#6129
mysql-test/r/view.result:
  Push a change to the result file from Sanja's patch.
mysql-test/t/sp.test:
  Rewrite the test for Bug#6129 (now that stored procedures don't
  evaluate system variables at parse, the test produced different results).
  The old test failed with 1 in the second invocation (the old
  result was wrong).
sql/item_func.cc:
  After-merge fix.
sql/item_func.h:
  After-merge fix.
sql/mysql_priv.h:
  After-merge fix.
sql/mysqld.cc:
  Rollback the patch for Bug#7403 (it breaks the test suite).
2005-07-16 16:10:42 +04:00
unknown
51308e2327 Post-review fix: Made test bug9538 test robust.
mysql-test/r/sp.result:
  Made test bug9538 test robust.
mysql-test/t/sp.test:
  Made test bug9538 test robust.
2005-07-15 19:46:44 +02:00
unknown
6f619804fc Fixed BUG#9538: SProc: Creation fails if we try to SET system variable
using @@var_name in proc
  Made sure we don't lose the tokenizer state when swapping lex in during SET
  parsing.


mysql-test/r/sp.result:
  New test case for BUG#9538.
mysql-test/t/sp.test:
  New test case for BUG#9538.
sql/sp_head.cc:
  Keep lex->next_state when swapping lex during SP parsing (for SET mainly),
  otherwise the tokenizer gets confused.
2005-07-15 17:24:19 +02:00
unknown
32e157ec0b Added test case for bug #9565 "Wrong locking in stored procedure if a
sub-sequent procedure is called" which was fixed by the same patch
as bug #9597 "read lock stays when querying view from stored procedure".


mysql-test/r/sp.result:
  Added test case for bug #9565 "Wrong locking in stored procedure if a
  sub-sequent procedure is called".
mysql-test/t/sp.test:
  Added test case for bug #9565 "Wrong locking in stored procedure if a
  sub-sequent procedure is called".
2005-07-15 13:34:48 +04:00
unknown
eb314af492 Merge mysql.com:/usr/local/bk/mysql-5.0
into  mysql.com:/home/pem/work/mysql-5.0


mysql-test/r/sp-error.result:
  Auto merged
mysql-test/r/sp.result:
  Auto merged
mysql-test/t/sp-error.test:
  Auto merged
mysql-test/t/sp.test:
  Auto merged
sql/sp.cc:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
2005-07-11 12:46:42 +02:00
unknown
eef5f17bde Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  mysql.com:/home/dlenev/src/mysql-5.0-bg8406


mysql-test/r/sp.result:
  Auto merged
mysql-test/r/trigger.result:
  Auto merged
mysql-test/t/sp.test:
  Auto merged
mysql-test/t/trigger.test:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/sp.cc:
  Auto merged
sql/sp_head.h:
  Auto merged
sql/sql_base.cc:
  Auto merged
sql/sql_lex.cc:
  Auto merged
sql/sql_lex.h:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_trigger.cc:
  Auto merged
mysql-test/r/sp-error.result:
  Manual merge.
mysql-test/t/sp-error.test:
  Manual merge.
sql/sp_head.cc:
  Manual merge.
sql/sql_yacc.yy:
  Manual merge.
2005-07-09 22:04:18 +04:00
unknown
14b1f91ba4 Enable support of access to tables from triggers. Thus fix bug #8406 "Triggers
crash if referencing a table" and several other related bugs.
Fix for bug #11834 "Re-execution of prepared statement with dropped function
crashes server." which was spotted during work on previous bugs.

Also couple of nice cleanups:
- Replaced two separate hashes for stored routines used by statement with one.
- Now instead of doing one pass through all routines used in statement for
  caching them and then doing another pass for adding their tables to table
  list, we do only one pass during which do both things.


mysql-test/r/sp-error.result:
  Added test for bug #11834 "Re-execution of prepared statement with dropped
  function crashes server" also covering handling of prepared statements
  which use stored functions but does not require prelocking.
mysql-test/r/sp.result:
  Updated test for LOCK TABLES with views in table list.
  (Old version of statement used in this test will work ok now, since prelocking
   algorithm was tuned and will lock only one multi-set of tables for each routine
   even if this routine is used in several different views).
mysql-test/r/trigger.result:
  Added several tests for triggers using tables.
mysql-test/t/sp-error.test:
  Added test for bug #11834 "Re-execution of prepared statement with dropped
  function crashes server" also covering handling of prepared statements
  which use stored functions but does not require prelocking.
mysql-test/t/sp.test:
  Updated comment about recursive views to reflect current situation.
  Updated test for LOCK TABLES with views in table list.
  (Old version of statement used in this test will work ok now, since prelocking
   algorithm was tuned and will lock only one multi-set of tables for each routine
   even if this routine is used in several different views).
mysql-test/t/trigger.test:
  Added several tests for triggers using tables.
sql/item_func.cc:
  Item_func_sp::cleanup():
    By next statement execution stored function can be dropped or altered so
    we can't assume that sp_head object for it will be still valid.
sql/sp.cc:
  - Added Sroutine_hash_entry structure that represents element in the set of
    stored routines used by statement or routine. We can't as before use
    LEX_STRING for this purprose because we want link all elements of this set
    in list.
  - Replaced sp_add_to_hash() with sp_add_used_routine() which takes into account
    that now we use one hash for stored routines used by statement instead of two
    and which mantains list linking all elelemnts in this hash.
  - Renamed sp_merge_hash() to sp_update_sp_used_routines().
  - Introduced sp_update_stmt_used_routines() for adding elements to the set of
    routines used by statement from another similar set for statement or routine.
    This function will also mantain list linking elements of destination set.
  - Now instead of one sp_cache_routines() function we have family of 
    sp_cache_routines_and_add_tables() functions which are also responsible for
    adding tables used by routines being cached to statement table list. Nice
    optimization - thanks to list linking all elements in the hash of routines
    used by statement we don't need to perform several iterations over this hash
    (as it was before in cases when we have added new elements to it).
sql/sp.h:
  Added declarations of functions used for manipulations with set (hash) of stored
  routines used by statement.
sql/sp_head.cc:
  sp_name::init_qname():
    Now sp_name also holds key identifying routine in the set (hash) of
    stored routines used by statement. 
  sp_head:
    Instead of two separate hashes sp_funs/m_spprocs representing sets of stored
    routines used by this routine we use one hash - m_sroutines. 
  sp_instr_set_trigger_field:
    Added support for subqueries in assignments to row accessors in triggers.
  Removed definition of sp_add_sp_tables_to_table_list() and auxilary functions 
  since now we don't have separate stage on which we add tables used by routines
  used by statement to table list for prelocking. We do it on the same stage as
  we load those routines in SP cache. So all this functionality moved to
  sp_cache_routines_and_add_tables() family of functions.
sql/sp_head.h:
  sp_name:
    Now this class also holds key identifying routine in the set (hash) of stored
    routines used by statement. 
  sp_head:
    Instead of two separate hashes sp_funs/m_spprocs representing sets of stored
    routines used by this routine we use one hash - m_sroutines. 
  sp_instr_set_trigger_field:
    Added support for subqueries in assignments to row accessors in triggers.
  Removed declaration of sp_add_sp_tables_to_table_list() since now we don't have
  separate stage on which we add tables used by routines used by statement to
  table list for prelocking. We do it on the same stage as we load those routines
  in SP cache.
sql/sql_base.cc:
  open_tables():
  - LEX::spfuns/spprocs hashes were replaced with one LEX::sroutines hash.
  - Now instead of doing one pass through all routines used in statement for
    caching them and then doing another pass for adding their tables to table
    list, we do only one pass during which do both things. It is easy to do
    since all routines in the set of routines used by statement are linked in
    the list. This also allows us to calculate table list for prelocking more
    precisely.
  - Now triggers properly inform prelocking algorithm about tables they use.
sql/sql_lex.cc:
  lex_start():
    Replaced LEX::spfuns/spprocs with with one LEX::sroutines hash.
    Added LEX::sroutines_list list linking all elements in this hash.
  st_lex::st_lex():
    Moved definition of LEX constructor to sql_lex.cc file to be able
    use sp_sroutine_key declaration from sp.h in it.
sql/sql_lex.h:
  LEX:
    Replaced two separate hashes for stored routines used by statement with one.
    Added list linking all elements in this hash to be able to iterate through all
    elements and add new elements to this hash at the same time.
    Moved constructor definition to sql_lex.cc.
sql/sql_parse.cc:
  mysql_execute_command():
    Replaced LEX::spfuns/spprocs with one LEX::sroutines hash.
sql/sql_trigger.cc:
  Added missing GNU GPL notice.
  Table_triggers_list::check_n_load()
    Added initialization of sroutines_key which stores key representing
    triggers of this table in the set (hash) of routines used by this statement.
sql/sql_trigger.h:
  Added missing GNU GPL notice.
  Table_triggers_list:
    Added sroutines_key member to store key representing triggers of this
    table in the set (hash) of routines used by this statement.
    Declared sp_cache_routines_and_add_tables_for_triggers() as friend since
    it needs access to sroutines_key and trigger bodies.
sql/sql_yacc.yy:
  - Now we use sp_add_used_routine() instead of sp_add_to_hash() for adding
    elements to the set of stored routines used in statement.
  - Enabled support of subqueries as right sides in assignments to triggers' row
    accessors.
2005-07-09 21:51:59 +04:00