- 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.
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.
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
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
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.
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.
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.)
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
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.
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
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.
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.)
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
(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
* 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.
"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.
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
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.
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
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
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.
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
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.
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
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.
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
* 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.
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)
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
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
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
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
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).
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.
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".
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
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.
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.