summaryrefslogtreecommitdiff
path: root/sql/sql_base.cc
diff options
context:
space:
mode:
authorunknown <dlenev@mysql.com>2005-08-09 11:43:55 +0400
committerunknown <dlenev@mysql.com>2005-08-09 11:43:55 +0400
commit8103db27bb931cefd9f59772954f8693ccfea640 (patch)
treebb9c0e1f9064cb7937fea43d87cf1464768b9e25 /sql/sql_base.cc
parent807a9c8dffa784557e0ed4dcd72175d44e1af917 (diff)
parent39fda600439547cfa49e2f00ebf93eb47bc479f9 (diff)
downloadmariadb-git-8103db27bb931cefd9f59772954f8693ccfea640.tar.gz
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
Diffstat (limited to 'sql/sql_base.cc')
-rw-r--r--sql/sql_base.cc24
1 files changed, 15 insertions, 9 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 5ff5e580f81..0895901508d 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -404,8 +404,7 @@ static void mark_used_tables_as_free_for_reuse(THD *thd, TABLE *table)
upper level) and will leave prelocked mode if needed.
*/
-void close_thread_tables(THD *thd, bool lock_in_use, bool skip_derived,
- TABLE *stopper)
+void close_thread_tables(THD *thd, bool lock_in_use, bool skip_derived)
{
bool found_old_table;
prelocked_mode_type prelocked_mode= thd->prelocked_mode;
@@ -512,7 +511,7 @@ void close_thread_tables(THD *thd, bool lock_in_use, bool skip_derived,
DBUG_PRINT("info", ("thd->open_tables: %p", thd->open_tables));
found_old_table= 0;
- while (thd->open_tables != stopper)
+ while (thd->open_tables)
found_old_table|=close_thread_table(thd, &thd->open_tables);
thd->some_tables_deleted=0;
@@ -1804,6 +1803,9 @@ err:
thd - thread handler
start - list of tables in/out
counter - number of opened tables will be return using this parameter
+ flags - bitmap of flags to modify how the tables will be open:
+ MYSQL_LOCK_IGNORE_FLUSH - open table even if someone has
+ done a flush or namelock on it.
NOTE
Unless we are already in prelocked mode, this function will also precache
@@ -1821,7 +1823,7 @@ err:
-1 - error
*/
-int open_tables(THD *thd, TABLE_LIST **start, uint *counter)
+int open_tables(THD *thd, TABLE_LIST **start, uint *counter, uint flags)
{
TABLE_LIST *tables;
bool refresh;
@@ -1900,7 +1902,7 @@ int open_tables(THD *thd, TABLE_LIST **start, uint *counter)
(*counter)++;
if (!tables->table &&
- !(tables->table= open_table(thd, tables, &new_frm_mem, &refresh, 0)))
+ !(tables->table= open_table(thd, tables, &new_frm_mem, &refresh, flags)))
{
free_root(&new_frm_mem, MYF(MY_KEEP_PREALLOC));
@@ -2143,7 +2145,8 @@ int simple_open_n_lock_tables(THD *thd, TABLE_LIST *tables)
{
DBUG_ENTER("simple_open_n_lock_tables");
uint counter;
- if (open_tables(thd, &tables, &counter) || lock_tables(thd, tables, counter))
+ if (open_tables(thd, &tables, &counter, 0) ||
+ lock_tables(thd, tables, counter))
DBUG_RETURN(-1); /* purecov: inspected */
DBUG_RETURN(0);
}
@@ -2170,7 +2173,7 @@ bool open_and_lock_tables(THD *thd, TABLE_LIST *tables)
{
uint counter;
DBUG_ENTER("open_and_lock_tables");
- if (open_tables(thd, &tables, &counter) ||
+ if (open_tables(thd, &tables, &counter, 0) ||
lock_tables(thd, tables, counter) ||
mysql_handle_derived(thd->lex, &mysql_derived_prepare) ||
(thd->fill_derived_tables() &&
@@ -2187,6 +2190,9 @@ bool open_and_lock_tables(THD *thd, TABLE_LIST *tables)
open_normal_and_derived_tables
thd - thread handler
tables - list of tables for open
+ flags - bitmap of flags to modify how the tables will be open:
+ MYSQL_LOCK_IGNORE_FLUSH - open table even if someone has
+ done a flush or namelock on it.
RETURN
FALSE - ok
@@ -2197,12 +2203,12 @@ bool open_and_lock_tables(THD *thd, TABLE_LIST *tables)
data from the tables.
*/
-bool open_normal_and_derived_tables(THD *thd, TABLE_LIST *tables)
+bool open_normal_and_derived_tables(THD *thd, TABLE_LIST *tables, uint flags)
{
uint counter;
DBUG_ENTER("open_normal_and_derived_tables");
DBUG_ASSERT(!thd->fill_derived_tables());
- if (open_tables(thd, &tables, &counter) ||
+ if (open_tables(thd, &tables, &counter, flags) ||
mysql_handle_derived(thd->lex, &mysql_derived_prepare))
DBUG_RETURN(TRUE); /* purecov: inspected */
DBUG_RETURN(0);