summaryrefslogtreecommitdiff
path: root/sql/sql_table.cc
diff options
context:
space:
mode:
authorunknown <monty@mashka.mysql.fi>2003-03-07 01:20:56 +0200
committerunknown <monty@mashka.mysql.fi>2003-03-07 01:20:56 +0200
commit81f368cc549ebd0078ef64b61bd92332edb5d319 (patch)
tree473a02ad21d3dcb150966988c72ab2d2a3dd7601 /sql/sql_table.cc
parent7ae420a4a17fab1b45ee56dc5cac2f8d9063baa5 (diff)
parent5861dc5b8b39b3f822a8968963a4783541d59b77 (diff)
downloadmariadb-git-81f368cc549ebd0078ef64b61bd92332edb5d319.tar.gz
Merge to get fix for LOCK TABLES + DROP TABLE in another thread
BitKeeper/etc/ignore: auto-union BitKeeper/deleted/.del-delete.result: Delete: mysql-test/r/delete.result client/mysqlbinlog.cc: Auto merged libmysql/libmysql.c: Auto merged mysql-test/t/delete.test: Auto merged mysql-test/t/type_datetime.test: Auto merged sql/field.h: Auto merged sql/lock.cc: Auto merged sql/share/polish/errmsg.txt: Auto merged sql/sql_select.cc: Auto merged mysql-test/r/type_datetime.result: Update results after merge sql/log_event.h: Use local version sql/mysql_priv.h: Use local version sql/mysqld.cc: Use local version sql/sql_repl.h: Use local version
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r--sql/sql_table.cc13
1 files changed, 7 insertions, 6 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 4c92c35632a..156d2b842f1 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
+/* Copyright (C) 2000-2003 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -80,7 +80,6 @@ int mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists)
{
my_error(ER_TABLE_NOT_LOCKED_FOR_WRITE,MYF(0),
tables->real_name);
- error = 1;
goto err;
}
while (global_read_lock && ! thd->killed)
@@ -93,7 +92,6 @@ int mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists)
err:
pthread_mutex_unlock(&LOCK_open);
- VOID(pthread_cond_broadcast(&COND_refresh)); // Signal to refresh
pthread_mutex_lock(&thd->mysys_var->mutex);
thd->mysys_var->current_mutex= 0;
@@ -138,7 +136,6 @@ int mysql_rm_table_part2_with_lock(THD *thd,
error=mysql_rm_table_part2(thd,tables, if_exists, dont_log_query);
pthread_mutex_unlock(&LOCK_open);
- VOID(pthread_cond_broadcast(&COND_refresh)); // Signal to refresh
pthread_mutex_lock(&thd->mysys_var->mutex);
thd->mysys_var->current_mutex= 0;
@@ -171,6 +168,9 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
bool some_tables_deleted=0, tmp_table_deleted=0;
DBUG_ENTER("mysql_rm_table_part2");
+ if (lock_table_names(thd, tables))
+ DBUG_RETURN(1);
+
for (table=tables ; table ; table=table->next)
{
char *db=table->db ? table->db : thd->db;
@@ -242,11 +242,12 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
}
}
- error = 0;
+ unlock_table_names(thd, tables);
+ error= 0;
if (wrong_tables.length())
{
my_error(ER_BAD_TABLE_ERROR,MYF(0),wrong_tables.c_ptr());
- error=1;
+ error= 1;
}
DBUG_RETURN(error);
}