summaryrefslogtreecommitdiff
path: root/sql/lock.cc
diff options
context:
space:
mode:
authorunknown <monty@hundin.mysql.fi>2001-09-02 13:47:00 +0300
committerunknown <monty@hundin.mysql.fi>2001-09-02 13:47:00 +0300
commitb67d11e17ca6ae8b4b0a0d5a5b5fccceff641a26 (patch)
treee5581eaf73302fbd721a4c17983fb6fdfca266d0 /sql/lock.cc
parentfc14066488c52252779495a411fee6de2e478192 (diff)
downloadmariadb-git-b67d11e17ca6ae8b4b0a0d5a5b5fccceff641a26.tar.gz
Changed DB_TYPE_INNOBASE to DB_TYPE_INNODB
Fix that DROP DATABASE works with all table types Use BULK_INSERT when inserting more than one row Better TRUNCATE TABLE BitKeeper/deleted/.del-compilation_finished.au.gz~70bd14095a918139: Delete: sounds/compilation_finished.au.gz BUILD/FINISH.sh: Removed 'finished' sound as this isn't a general solution. Docs/manual.texi: Added upgrading from 3.23 configure.in: Fixed version number sql/ha_innobase.cc: Default creation of InnoDB tables. sql/ha_myisam.cc: Disable BULK_INSERT of using safe mode sql/handler.cc: Changed DB_TYPE_INNOBASE to DB_TYPE_INNODB sql/handler.h: Changed DB_TYPE_INNOBASE to DB_TYPE_INNODB sql/lock.cc: Added lock_and_wait_for_table_name sql/mysql_priv.h: Better TRUNCATE TABLE sql/sql_db.cc: Fix that DROP DATABASE works with all table types sql/sql_delete.cc: Better TRUNCATE TABLE sql/sql_insert.cc: Use BULK_INSERT when inserting more than one row sql/sql_load.cc: Small bug fix. sql/sql_parse.cc: Better TRUNCATE TABLE sql/sql_select.cc: Change INNOBASE -> INNODB sql/sql_table.cc: Better TRUNCATE TABLE sql/sql_yacc.yy: INNOBASE -> INNODB sql/thr_malloc.cc: Fix for replication
Diffstat (limited to 'sql/lock.cc')
-rw-r--r--sql/lock.cc31
1 files changed, 30 insertions, 1 deletions
diff --git a/sql/lock.cc b/sql/lock.cc
index 561ce94f88b..f523f10b3a7 100644
--- a/sql/lock.cc
+++ b/sql/lock.cc
@@ -371,6 +371,36 @@ static MYSQL_LOCK *get_lock_data(THD *thd, TABLE **table_ptr, uint count,
*****************************************************************************/
/*
+ Lock and wait for the named lock.
+ Returns 0 on ok
+*/
+
+int lock_and_wait_for_table_name(THD *thd, TABLE_LIST *table_list)
+{
+ int lock_retcode;
+ int error= -1;
+ DBUG_ENTER("lock_and_wait_for_table_name");
+
+ if (wait_if_global_read_lock(thd,0))
+ DBUG_RETURN(1);
+ VOID(pthread_mutex_lock(&LOCK_open));
+ if ((lock_retcode = lock_table_name(thd, table_list)) < 0)
+ goto end;
+ if (lock_retcode && wait_for_locked_table_names(thd, table_list))
+ {
+ unlock_table_name(thd, table_list);
+ goto end;
+ }
+ error=0;
+
+end:
+ start_waiting_global_read_lock(thd);
+ pthread_mutex_unlock(&LOCK_open);
+ DBUG_RETURN(error);
+}
+
+
+/*
Put a not open table with an old refresh version in the table cache.
This will force any other threads that uses the table to release it
as soon as possible.
@@ -381,7 +411,6 @@ static MYSQL_LOCK *get_lock_data(THD *thd, TABLE **table_ptr, uint count,
> 0 table locked, but someone is using it
*/
-
int lock_table_name(THD *thd, TABLE_LIST *table_list)
{
TABLE *table;