summaryrefslogtreecommitdiff
path: root/libmysqld/libmysqld.c
diff options
context:
space:
mode:
authorhf@deer.(none) <>2003-09-08 13:11:18 +0500
committerhf@deer.(none) <>2003-09-08 13:11:18 +0500
commit2ba517a3f14653006f2e309494256bfd47c34d4d (patch)
tree9bb4fb9d26d9619c909331d361eb2b1a642f4117 /libmysqld/libmysqld.c
parentbebe295dfed41e11e3e52abb1f66ce7ce82706f9 (diff)
downloadmariadb-git-2ba517a3f14653006f2e309494256bfd47c34d4d.tar.gz
fix for #1210
Diffstat (limited to 'libmysqld/libmysqld.c')
-rw-r--r--libmysqld/libmysqld.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/libmysqld/libmysqld.c b/libmysqld/libmysqld.c
index 48b3397ee7c..0c772587c4b 100644
--- a/libmysqld/libmysqld.c
+++ b/libmysqld/libmysqld.c
@@ -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);