diff options
author | Konstantin Osipov <kostja@sun.com> | 2009-12-08 17:13:12 +0300 |
---|---|---|
committer | Konstantin Osipov <kostja@sun.com> | 2009-12-08 17:13:12 +0300 |
commit | 302352723e8fbf69b9d02604c84a79fa56e69b7b (patch) | |
tree | a89672143d8c1f4bec0ae0ba85c2a1f992845d5d /sql/sp.h | |
parent | 97d2a9233bea5937f136ecc513fcbb28481b9289 (diff) | |
download | mariadb-git-302352723e8fbf69b9d02604c84a79fa56e69b7b.tar.gz |
Backport of:
----------------------------------------------------------
revno: 2617.69.24
committer: Konstantin Osipov <kostja@sun.com>
branch nick: 5.4-42546
timestamp: Fri 2009-08-14 19:22:05 +0400
message:
A pre-requisite for a fix for Bug#42546 "Backup: RESTORE fails, thinking it
finds an existing table"
Back-port from WL 148 "Foreign keys" feature tree a patch
that introduced Prelocking_strategy class -- a way to parameterize
open_tables() behaviour, implemented by Dmitry Lenev.
(Part of WL#4284).
sql/sql_base.cc:
Implement different prelocking strategies. Use an instance of
prelocking_strategy in open_tables().
sql/sql_class.h:
Add declarations for class Prelocking_strategy.
sql/sql_lex.h:
Add a helper method to access last table of the global table list
(lex->query_tables).
sql/sql_parse.cc:
Use a special prelocking strategy when locking tables for LOCK TABLES.
sql/sql_table.cc:
Use normal open_and_lock_tables_derived() in ALTER TABLE.
sql/sql_yacc.yy:
Modify the grammar to not pollute the global table list with tables
that should not be opened.
Diffstat (limited to 'sql/sp.h')
-rw-r--r-- | sql/sp.h | 50 |
1 files changed, 38 insertions, 12 deletions
@@ -42,6 +42,9 @@ sp_head * sp_find_routine(THD *thd, int type, sp_name *name, sp_cache **cp, bool cache_only); +int +sp_cache_routine(THD *thd, int type, sp_name *name, sp_head **sp); + bool sp_exist_routines(THD *thd, TABLE_LIST *procs, bool any); @@ -60,22 +63,45 @@ sp_update_routine(THD *thd, int type, sp_name *name, st_sp_chistics *chistics); int sp_drop_routine(THD *thd, int type, sp_name *name); + +/** + Structure that represents element in the set of stored routines + used by statement or routine. +*/ + +struct Sroutine_hash_entry +{ + /** + Set key consisting of one-byte routine type and quoted routine name. + */ + LEX_STRING key; + /** + Next element in list linking all routines in set. See also comments + for LEX::sroutine/sroutine_list and sp_head::m_sroutines. + */ + Sroutine_hash_entry *next; + /** + Uppermost view which directly or indirectly uses this routine. + 0 if routine is not used in view. Note that it also can be 0 if + statement uses routine both via view and directly. + */ + TABLE_LIST *belong_to_view; +}; + + /* - Procedures for pre-caching of stored routines and building table list - for prelocking. + Procedures for handling sets of stored routines used by statement or routine. */ -void sp_get_prelocking_info(THD *thd, bool *need_prelocking, - bool *first_no_prelocking); -void sp_add_used_routine(LEX *lex, Query_arena *arena, +void sp_add_used_routine(Query_tables_list *prelocking_ctx, Query_arena *arena, sp_name *rt, char rt_type); -void sp_remove_not_own_routines(LEX *lex); +bool sp_add_used_routine(Query_tables_list *prelocking_ctx, Query_arena *arena, + const LEX_STRING *key, TABLE_LIST *belong_to_view); +void sp_remove_not_own_routines(Query_tables_list *prelocking_ctx); void sp_update_sp_used_routines(HASH *dst, HASH *src); -int sp_cache_routines_and_add_tables(THD *thd, LEX *lex, - bool first_no_prelock); -int sp_cache_routines_and_add_tables_for_view(THD *thd, LEX *lex, - TABLE_LIST *view); -int sp_cache_routines_and_add_tables_for_triggers(THD *thd, LEX *lex, - TABLE_LIST *table); +void sp_update_stmt_used_routines(THD *thd, Query_tables_list *prelocking_ctx, + HASH *src, TABLE_LIST *belong_to_view); +void sp_update_stmt_used_routines(THD *thd, Query_tables_list *prelocking_ctx, + SQL_LIST *src, TABLE_LIST *belong_to_view); extern "C" uchar* sp_sroutine_key(const uchar *ptr, size_t *plen, my_bool first); |