summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--client/Makefile.am21
-rw-r--r--sql/lock.cc52
-rw-r--r--sql/set_var.h2
3 files changed, 54 insertions, 21 deletions
diff --git a/client/Makefile.am b/client/Makefile.am
index 2c54ec45989..2db1e49850d 100644
--- a/client/Makefile.am
+++ b/client/Makefile.am
@@ -19,7 +19,8 @@
#AUTOMAKE_OPTIONS = nostdinc
INCLUDES = -I$(top_srcdir)/include $(openssl_includes)
LIBS = @CLIENT_LIBS@
-LDADD = @CLIENT_EXTRA_LDFLAGS@ ../libmysql/libmysqlclient.la
+DEPLIB= ../libmysql/libmysqlclient.la
+LDADD = @CLIENT_EXTRA_LDFLAGS@ $(DEPLIB)
bin_PROGRAMS = mysql mysqladmin mysqlcheck mysqlshow \
mysqldump mysqlimport mysqltest mysqlbinlog mysqlmanagerc mysqlmanager-pwgen
noinst_HEADERS = sql_string.h completion_hash.h my_readline.h \
@@ -27,18 +28,18 @@ noinst_HEADERS = sql_string.h completion_hash.h my_readline.h \
mysql_SOURCES = mysql.cc readline.cc sql_string.cc completion_hash.cc
mysql_LDADD = @readline_link@ @TERMCAP_LIB@ $(LDADD) $(CXXLDFLAGS)
mysqlbinlog_LDADD = $(LDADD) $(CXXLDFLAGS)
-mysql_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES)
-mysqladmin_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES)
-mysqlcheck_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES)
-mysqlshow_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES)
-mysqldump_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES)
-mysqlimport_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES)
+mysql_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES) $(DEPLIB)
+mysqladmin_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES) $(DEPLIB)
+mysqlcheck_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES) $(DEPLIB)
+mysqlshow_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES) $(DEPLIB)
+mysqldump_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES) $(DEPLIB)
+mysqlimport_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES) $(DEPLIB)
mysqltest_SOURCES= mysqltest.c
-mysqltest_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES)
+mysqltest_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES) $(DEPLIB)
mysqlbinlog_SOURCES = mysqlbinlog.cc ../mysys/mf_tempdir.c
-mysqlbinlog_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES)
+mysqlbinlog_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES) $(DEPLIB)
mysqlmanagerc_SOURCES = mysqlmanagerc.c
-mysqlmanagerc_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES)
+mysqlmanagerc_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES) $(DEPLIB)
sql_src=log_event.h log_event.cc
# Fix for mit-threads
diff --git a/sql/lock.cc b/sql/lock.cc
index 171c880db3e..923932a768a 100644
--- a/sql/lock.cc
+++ b/sql/lock.cc
@@ -445,14 +445,27 @@ static MYSQL_LOCK *get_lock_data(THD *thd, TABLE **table_ptr, uint count,
return sql_lock;
}
+
/*****************************************************************************
-** Lock table based on the name.
-** This is used when we need total access to a closed, not open table
+ Lock table based on the name.
+ This is used when we need total access to a closed, not open table
*****************************************************************************/
/*
Lock and wait for the named lock.
- Returns 0 on ok
+
+ SYNOPSIS
+ lock_and_wait_for_table_name()
+ thd Thread handler
+ table_list Lock first table in this list
+
+
+ NOTES
+ Works together with global read lock.
+
+ RETURN
+ 0 ok
+ 1 error
*/
int lock_and_wait_for_table_name(THD *thd, TABLE_LIST *table_list)
@@ -482,13 +495,28 @@ end:
/*
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.
- One must have a lock on LOCK_open !
- Return values:
- < 0 error
- == 0 table locked
- > 0 table locked, but someone is using it
+
+ SYNPOSIS
+ lock_table_name()
+ thd Thread handler
+ table_list Lock first table in this list
+
+ WARNING
+ If you are going to update the table, you should use
+ lock_and_wait_for_table_name instead of this function as this works
+ together with 'FLUSH TABLES WITH READ LOCK'
+
+ NOTES
+ This will force any other threads that uses the table to release it
+ as soon as possible.
+
+ REQUIREMENTS
+ One must have a lock on LOCK_open !
+
+ RETURN:
+ < 0 error
+ == 0 table locked
+ > 0 table locked, but someone is using it
*/
int lock_table_name(THD *thd, TABLE_LIST *table_list)
@@ -588,6 +616,10 @@ bool wait_for_locked_table_names(THD *thd, TABLE_LIST *table_list)
table_list Names of tables to lock
NOTES
+ If you are just locking one table, you should use
+ lock_and_wait_for_table_name().
+
+ REQUIREMENTS
One must have a lock on LOCK_open when calling this
RETURN
diff --git a/sql/set_var.h b/sql/set_var.h
index fbc03af714c..1cac2953a21 100644
--- a/sql/set_var.h
+++ b/sql/set_var.h
@@ -505,7 +505,7 @@ public:
sys_var_character_set(const char *name_arg) :sys_var_thd(name_arg)
{ nullable= 0; }
bool check(THD *thd, set_var *var);
-SHOW_TYPE type() { return SHOW_CHAR; }
+ SHOW_TYPE type() { return SHOW_CHAR; }
bool check_update_type(Item_result type)
{
return type != STRING_RESULT; /* Only accept strings */