diff options
Diffstat (limited to 'libmysqld')
-rw-r--r-- | libmysqld/lib_sql.cc | 4 | ||||
-rw-r--r-- | libmysqld/libmysqld.c | 21 |
2 files changed, 10 insertions, 15 deletions
diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc index 00658eaffdd..bda4cf6583d 100644 --- a/libmysqld/lib_sql.cc +++ b/libmysqld/lib_sql.cc @@ -26,8 +26,8 @@ static int fake_argc= 1; static char *fake_argv[]= {(char *)"", 0}; static const char *fake_groups[] = { "server", "embedded", 0 }; -static char org_my_init_done; -char server_inited; +static my_bool org_my_init_done; +my_bool server_inited; #if defined (__WIN__) #include "../sql/mysqld.cpp" diff --git a/libmysqld/libmysqld.c b/libmysqld/libmysqld.c index f403400812f..56be78e3509 100644 --- a/libmysqld/libmysqld.c +++ b/libmysqld/libmysqld.c @@ -244,25 +244,18 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user, db ? db : "(Null)", user ? user : "(Null)")); -#ifdef EMBEDDED_LIBRARY - /* - Here we check that mysql_server_init was called before. - Actually we can perform the test for client (not embedded) library as well. - But i'm afraid some old applications will be broken then. - */ +#if defined(EMBEDDED_LIBRARY) || !defined(DBUG_OFF) if (!server_inited) { mysql->net.last_errno=CR_MYSQL_SERVER_INIT_MISSED; strmov(mysql->net.last_error,ER(mysql->net.last_errno)); goto error; } -#endif /*EMBEDDED_LIBRARY*/ +#endif - if (mysql->options.methods_to_use == MYSQL_OPT_USE_REMOTE_CONNECTION) - cli_mysql_real_connect(mysql, host, user, - passwd, db, port, unix_socket, client_flag); - if ((mysql->options.methods_to_use == MYSQL_OPT_GUESS_CONNECTION) && - host && strcmp(host,LOCAL_HOST)) + if (mysql->options.methods_to_use == MYSQL_OPT_USE_REMOTE_CONNECTION || + (mysql->options.methods_to_use == MYSQL_OPT_GUESS_CONNECTION && + host && strcmp(host,LOCAL_HOST))) cli_mysql_real_connect(mysql, host, user, passwd, db, port, unix_socket, client_flag); @@ -325,7 +318,8 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user, DBUG_RETURN(mysql); error: - DBUG_PRINT("error",("message: %u (%s)",mysql->net.last_errno,mysql->net.last_error)); + DBUG_PRINT("error",("message: %u (%s)", mysql->net.last_errno, + mysql->net.last_error)); { /* Free alloced memory */ my_bool free_me=mysql->free_me; @@ -337,6 +331,7 @@ error: DBUG_RETURN(0); } + /************************************************************************* ** Send a QUIT to the server and close the connection ** If handle is alloced by mysql connect free it. |