diff options
author | hf@deer.(none) <> | 2003-05-31 15:15:46 +0500 |
---|---|---|
committer | hf@deer.(none) <> | 2003-05-31 15:15:46 +0500 |
commit | 02d3d7e8bd0b5a582befe8d02d41c9cca1bcfe8e (patch) | |
tree | 4dd324e7d5c4509bfa76cfb1ebecf8f75b9cc6f5 /sql | |
parent | 6bc3473f8883783f4613d25af99f89f06b12c600 (diff) | |
download | mariadb-git-02d3d7e8bd0b5a582befe8d02d41c9cca1bcfe8e.tar.gz |
SCRUM:
Here is another pack of changes about gathering common client code in
sql-common/client.c.
Now i symlink the client.c from sql/ and libmysql/. These directories
have client_settings.h files to be included to client.c. It contains
defines and declarations to compile client.c in appropriate manner.
Also i've added include/sql_common.h, containing declarations of what
is exported from client.c
I removed as many #ifdef-s from client.c as i dared to. I think it's better
push it with some extra #ifdef-s now (of course, if everythihg besides it is
ok) so other people can check the code.
Diffstat (limited to 'sql')
-rw-r--r-- | sql/Makefile.am | 8 | ||||
-rw-r--r-- | sql/client_settings.h | 33 | ||||
-rw-r--r-- | sql/repl_failsafe.cc | 5 | ||||
-rw-r--r-- | sql/slave.cc | 9 | ||||
-rw-r--r-- | sql/sql_repl.cc | 1 |
5 files changed, 45 insertions, 11 deletions
diff --git a/sql/Makefile.am b/sql/Makefile.am index 608b959a8b9..eeaf96ce190 100644 --- a/sql/Makefile.am +++ b/sql/Makefile.am @@ -55,9 +55,9 @@ noinst_HEADERS = item.h item_func.h item_sum.h item_cmpfunc.h \ opt_range.h opt_ft.h protocol.h \ sql_select.h structs.h table.h sql_udf.h hash_filo.h\ lex.h lex_symbol.h sql_acl.h sql_crypt.h \ - log_event.h mini_client.h sql_repl.h slave.h \ + log_event.h sql_repl.h slave.h \ stacktrace.h sql_sort.h sql_cache.h set_var.h \ - spatial.h gstream.h + spatial.h gstream.h client_settings.h mysqld_SOURCES = sql_lex.cc sql_handler.cc \ item.cc item_sum.cc item_buff.cc item_func.cc \ item_cmpfunc.cc item_strfunc.cc item_timefunc.cc \ @@ -83,7 +83,7 @@ mysqld_SOURCES = sql_lex.cc sql_handler.cc \ sql_load.cc mf_iocache.cc field_conv.cc sql_show.cc \ sql_udf.cc sql_analyse.cc sql_analyse.h sql_cache.cc \ slave.cc sql_repl.cc sql_union.cc sql_derived.cc \ - mini_client.cc mini_client_errors.c pack.c\ + client.c mini_client_errors.c pack.c\ stacktrace.c repl_failsafe.h repl_failsafe.cc sql_olap.cc\ gstream.cc spatial.cc sql_help.cc protocol_cursor.cc gen_lex_hash_SOURCES = gen_lex_hash.cc @@ -104,6 +104,8 @@ link_sources: @LN_CP_F@ ../libmysql/errmsg.c mini_client_errors.c rm -f pack.c @LN_CP_F@ ../sql-common/pack.c pack.c + rm -f client.c + @LN_CP_F@ ../sql-common/client.c client.c gen_lex_hash.o: gen_lex_hash.cc lex.h $(CXXCOMPILE) -c $(INCLUDES) $< diff --git a/sql/client_settings.h b/sql/client_settings.h new file mode 100644 index 00000000000..de0c7f40717 --- /dev/null +++ b/sql/client_settings.h @@ -0,0 +1,33 @@ +/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult 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 + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + + +#ifndef _client_settings_h +#define _client_settings_h +#include <thr_alarm.h> +#include <mysql_embed.h> +#include <mysql_com.h> + + +#define CLIENT_CAPABILITIES (CLIENT_LONG_PASSWORD | CLIENT_LONG_FLAG | \ + CLIENT_LOCAL_FILES | CLIENT_SECURE_CONNECTION) + + +extern ulong slave_net_timeout; +#define init_sigpipe_variables +#define set_sigpipe(mysql) +#define reset_sigpipe(mysql) +#endif /* _client_settings_h */ diff --git a/sql/repl_failsafe.cc b/sql/repl_failsafe.cc index 1d0801fc3c1..2aa8f492ed3 100644 --- a/sql/repl_failsafe.cc +++ b/sql/repl_failsafe.cc @@ -23,7 +23,6 @@ #include "sql_repl.h" #include "slave.h" #include "sql_acl.h" -#include "mini_client.h" #include "log_event.h" #include <mysql.h> @@ -669,9 +668,9 @@ int connect_to_master(THD *thd, MYSQL* mysql, MASTER_INFO* mi) strmov(mysql->net.last_error, "Master is not configured"); DBUG_RETURN(1); } + mysql_options(mysql, MYSQL_OPT_CONNECT_TIMEOUT, (char *)&slave_net_timeout); if (!mysql_real_connect(mysql, mi->host, mi->user, mi->password, 0, - mi->port, 0, 0, - slave_net_timeout)) + mi->port, 0, 0)) DBUG_RETURN(1); DBUG_RETURN(0); } diff --git a/sql/slave.cc b/sql/slave.cc index cc40df38eff..a49389e0ec7 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -20,12 +20,12 @@ #include <mysql.h> #include <myisam.h> -#include "mini_client.h" #include "slave.h" #include "sql_repl.h" #include "repl_failsafe.h" #include <thr_alarm.h> #include <my_dir.h> +#include <sql_common.h> bool use_slave_mask = 0; MY_BITMAP slave_error_mask; @@ -2948,9 +2948,10 @@ static int connect_to_master(THD* thd, MYSQL* mysql, MASTER_INFO* mi, while (!(slave_was_killed = io_slave_killed(thd,mi)) && (reconnect ? mysql_reconnect(mysql) != 0: - !mysql_real_connect(mysql, mi->host, mi->user, mi->password, 0, - mi->port, 0, client_flag, - thd->variables.net_read_timeout))) + !(mysql_options(mysql, MYSQL_OPT_CONNECT_TIMEOUT, + (char *)&thd->variables.net_read_timeout), + mysql_real_connect(mysql, mi->host, mi->user, mi->password, 0, + mi->port, 0, client_flag)))) { /* Don't repeat last error */ if ((int)mysql_errno(mysql) != last_errno) diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index b8f6de30840..fe47e553cf3 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -22,7 +22,6 @@ #include "sql_repl.h" #include "sql_acl.h" #include "log_event.h" -#include "mini_client.h" #include <my_dir.h> extern const char* any_db; |