mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
fix for #1210
include/errmsg.h: Error code added libmysql/errmsg.c: Error message added libmysqld/lib_sql.cc: static inited variable changed to global server_inited libmysqld/libmysqld.c: check for mysql_server_init execution added
This commit is contained in:
@ -79,6 +79,8 @@ struct passwd *getpwuid(uid_t);
|
||||
char* getlogin(void);
|
||||
#endif
|
||||
|
||||
extern char server_inited;
|
||||
|
||||
#ifdef __WIN__
|
||||
static my_bool is_NT(void)
|
||||
{
|
||||
@ -210,6 +212,20 @@ 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 (!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*/
|
||||
|
||||
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);
|
||||
|
Reference in New Issue
Block a user