diff options
author | unknown <sergefp@mysql.com> | 2005-08-03 03:37:32 +0000 |
---|---|---|
committer | unknown <sergefp@mysql.com> | 2005-08-03 03:37:32 +0000 |
commit | b323667ffc7176482073ca7d626560dcd8d7ee75 (patch) | |
tree | ab04bd1a5e1f34ad54866fd6df3fab3dfb0ae2e2 /sql/sql_base.cc | |
parent | 11abe15eab3f444b600200e965cf18539af55392 (diff) | |
download | mariadb-git-b323667ffc7176482073ca7d626560dcd8d7ee75.tar.gz |
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.
Diffstat (limited to 'sql/sql_base.cc')
-rw-r--r-- | sql/sql_base.cc | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 367bd2c5ade..90e31edd9bb 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -1865,23 +1865,21 @@ int open_tables(THD *thd, TABLE_LIST **start, uint *counter) document new prelocked behavior. */ - if (!thd->prelocked_mode && !thd->lex->requires_prelocking()) + if (!thd->prelocked_mode && !thd->lex->requires_prelocking() && + thd->lex->sroutines_list.elements) { - bool first_no_prelocking; - if (sp_need_cache_routines(thd, &thd->lex->sroutines_list, - &first_no_prelocking)) - { - TABLE_LIST **save_query_tables_last= thd->lex->query_tables_last; + bool first_no_prelocking, need_prelocking; + TABLE_LIST **save_query_tables_last= thd->lex->query_tables_last; - DBUG_ASSERT(thd->lex->query_tables == *start); + DBUG_ASSERT(thd->lex->query_tables == *start); + sp_get_prelocking_info(thd, &need_prelocking, &first_no_prelocking); - if (sp_cache_routines_and_add_tables(thd, thd->lex, - first_no_prelocking) || - *start) - { - query_tables_last_own= save_query_tables_last; - *start= thd->lex->query_tables; - } + if ((sp_cache_routines_and_add_tables(thd, thd->lex, + first_no_prelocking) || + *start) && need_prelocking) + { + query_tables_last_own= save_query_tables_last; + *start= thd->lex->query_tables; } } @@ -1917,8 +1915,9 @@ int open_tables(THD *thd, TABLE_LIST **start, uint *counter) 2) Tables used by all stored routines that this statement invokes on execution. We need to know where the bound between these two parts is. If we've - just opened the last table in part #1, and it added tables after - itself, adjust the boundary pointer accordingly. + just opened a view, which was the last table in part #1, and it + has added its base tables after itself, adjust the boundary pointer + accordingly. */ if (query_tables_last_own && query_tables_last_own == &(tables->next_global) && |