summaryrefslogtreecommitdiff
path: root/sql-common/client.c
diff options
context:
space:
mode:
authorunknown <hf@deer.(none)>2003-07-04 13:21:14 +0500
committerunknown <hf@deer.(none)>2003-07-04 13:21:14 +0500
commit7248ab7b59ca11b83cb9543a3050499157d8d5fc (patch)
tree8d9d48e6d2ba9a4f0332cb4bda4fe3dbe23651d6 /sql-common/client.c
parentc2a4a0ec552e3000b45c6ef2b4148fb0845d5f41 (diff)
parent14fd42e13ff008247ede01c48780539f23931e2d (diff)
downloadmariadb-git-7248ab7b59ca11b83cb9543a3050499157d8d5fc.tar.gz
Resolving conflicts
BitKeeper/etc/logging_ok: auto-union client/mysqltest.c: Auto merged sql-common/client.c: Auto merged sql/protocol.cc: Auto merged sql/sql_client.cc: Auto merged include/mysql.h: Merging (prolly it's the mistake) libmysqld/libmysqld.c: This code seems to be unnecessary
Diffstat (limited to 'sql-common/client.c')
-rw-r--r--sql-common/client.c74
1 files changed, 51 insertions, 23 deletions
diff --git a/sql-common/client.c b/sql-common/client.c
index 721164c8301..ea0d079511f 100644
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@ -38,7 +38,26 @@
#include <my_global.h>
#include "mysql.h"
+
+#ifdef EMBEDDED_LIBRARY
+
+#undef MYSQL_SERVER
+
+#ifndef MYSQL_CLIENT
+#define MYSQL_CLIENT
+#endif
+
+#define CLI_MYSQL_REAL_CONNECT cli_mysql_real_connect
+
+#undef net_flush
+my_bool net_flush(NET *net);
+
+#else /*EMBEDDED_LIBRARY*/
+#define CLI_MYSQL_REAL_CONNECT mysql_real_connect
+#endif /*EMBEDDED_LIBRARY*/
+
#if !defined(MYSQL_SERVER) && (defined(__WIN__) || defined(_WIN32) || defined(_WIN64))
+
#include <winsock.h>
#include <odbcinst.h>
#endif /* !defined(MYSQL_SERVER) && (defined(__WIN__) ... */
@@ -572,8 +591,8 @@ void free_rows(MYSQL_DATA *cur)
}
}
-my_bool
-advanced_command(MYSQL *mysql, enum enum_server_command command,
+static my_bool
+cli_advanced_command(MYSQL *mysql, enum enum_server_command command,
const char *header, ulong header_length,
const char *arg, ulong arg_length, my_bool skip_check)
{
@@ -635,13 +654,6 @@ end:
return result;
}
-my_bool
-simple_command(MYSQL *mysql,enum enum_server_command command, const char *arg,
- ulong length, my_bool skip_check)
-{
- return advanced_command(mysql, command, NullS, 0, arg, length, skip_check);
-}
-
void free_old_query(MYSQL *mysql)
{
DBUG_ENTER("free_old_query");
@@ -759,8 +771,8 @@ static int add_init_command(struct st_mysql_options *options, const char *cmd)
return 0;
}
-static void mysql_read_default_options(struct st_mysql_options *options,
- const char *filename,const char *group)
+void mysql_read_default_options(struct st_mysql_options *options,
+ const char *filename,const char *group)
{
int argc;
char *argv_buff[1],**argv;
@@ -1278,6 +1290,7 @@ mysql_init(MYSQL *mysql)
#ifdef HAVE_SMEM
mysql->options.shared_memory_base_name= (char*) def_shared_memory_base_name;
#endif
+ mysql->options.methods_to_use= MYSQL_OPT_GUESS_CONNECTION;
return mysql;
}
@@ -1409,10 +1422,24 @@ error:
before calling mysql_real_connect !
*/
-MYSQL * STDCALL
-mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
- const char *passwd, const char *db,
- uint port, const char *unix_socket,ulong client_flag)
+static void STDCALL cli_mysql_close(MYSQL *mysql);
+static my_bool STDCALL cli_mysql_read_query_result(MYSQL *mysql);
+static MYSQL_RES * STDCALL cli_mysql_store_result(MYSQL *mysql);
+static MYSQL_RES * STDCALL cli_mysql_use_result(MYSQL *mysql);
+
+static MYSQL_METHODS client_methods=
+{
+ cli_mysql_close,
+ cli_mysql_read_query_result,
+ cli_advanced_command,
+ cli_mysql_store_result,
+ cli_mysql_use_result
+};
+
+MYSQL * STDCALL
+CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
+ const char *passwd, const char *db,
+ uint port, const char *unix_socket,ulong client_flag)
{
char buff[NAME_LEN+USERNAME_LENGTH+100],charset_name_buff[16];
char *end,*host_info,*charset_name;
@@ -1441,6 +1468,7 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
user ? user : "(Null)"));
/* Don't give sigpipe errors if the client doesn't want them */
+ mysql->methods= &client_methods;
set_sigpipe(mysql);
net->vio = 0; /* If something goes wrong */
mysql->client_flag=0; /* For handshake */
@@ -2112,8 +2140,7 @@ static void mysql_close_free(MYSQL *mysql)
}
-void STDCALL
-mysql_close(MYSQL *mysql)
+static void STDCALL cli_mysql_close(MYSQL *mysql)
{
DBUG_ENTER("mysql_close");
if (mysql) /* Some simple safety */
@@ -2165,8 +2192,7 @@ mysql_close(MYSQL *mysql)
DBUG_VOID_RETURN;
}
-
-my_bool STDCALL mysql_read_query_result(MYSQL *mysql)
+static my_bool STDCALL cli_mysql_read_query_result(MYSQL *mysql)
{
uchar *pos;
ulong field_count;
@@ -2283,8 +2309,7 @@ mysql_real_query(MYSQL *mysql, const char *query, ulong length)
mysql_data_seek may be used.
**************************************************************************/
-MYSQL_RES * STDCALL
-mysql_store_result(MYSQL *mysql)
+static MYSQL_RES * STDCALL cli_mysql_store_result(MYSQL *mysql)
{
MYSQL_RES *result;
DBUG_ENTER("mysql_store_result");
@@ -2339,8 +2364,7 @@ mysql_store_result(MYSQL *mysql)
have to wait for the client (and will not wait more than 30 sec/packet).
**************************************************************************/
-MYSQL_RES * STDCALL
-mysql_use_result(MYSQL *mysql)
+static MYSQL_RES * STDCALL cli_mysql_use_result(MYSQL *mysql)
{
MYSQL_RES *result;
DBUG_ENTER("mysql_use_result");
@@ -2477,6 +2501,10 @@ mysql_options(MYSQL *mysql,enum mysql_option option, const char *arg)
my_free(mysql->options.shared_memory_base_name,MYF(MY_ALLOW_ZERO_PTR));
mysql->options.shared_memory_base_name=my_strdup(arg,MYF(MY_WME));
#endif
+ case MYSQL_OPT_USE_REMOTE_CONNECTION:
+ case MYSQL_OPT_USE_EMBEDDED_CONNECTION:
+ case MYSQL_OPT_GUESS_CONNECTION:
+ mysql->options.methods_to_use= option;
break;
default:
DBUG_RETURN(1);