From a4b0a2cf67356c0f8f80b5291b3c1f4f8327cb97 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 27 Feb 2008 12:42:43 +0400 Subject: Bug #25097 mysql_server_init fails silently if no errmsg.sys is present. There was no way to return an error from the client library if no MYSQL connections was established. So here i added variables to store that king of errors and made functions like mysql_error(NULL) to return these. client/mysql.cc: Bug #25097 mysql_server_init fails silently if no errmsg.sys is present. Show the error message on std_error include/sql_common.h: Bug #25097 mysql_server_init fails silently if no errmsg.sys is present. cant_connect_sqlstate constant declared libmysql/libmysql.c: Bug #25097 mysql_server_init fails silently if no errmsg.sys is present. mysql_sqlstate(NULL) returns 'unknown_sqlstate' libmysqld/lib_sql.cc: Bug #25097 mysql_server_init fails silently if no errmsg.sys is present. EMBEDDED_SERVER version of the vprint_msg_to_log() implemented sql-common/client.c: Bug #25097 mysql_server_init fails silently if no errmsg.sys is present. mysql_server_last_errno and mysql_server_last_error introduced to store errors not related to particular connections. mysql_error(NULL) and mysql_errno(NULL) now returns these mysql_server_last_error and errno respectively sql/log.cc: Bug #25097 mysql_server_init fails silently if no errmsg.sys is present. EMBEDDED_LIBRARY implementation of the vprint_msg_to_log() moved to lib_sql.cc --- libmysql/libmysql.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libmysql/libmysql.c') diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index 4afc3ec5925..0320126a522 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -1486,7 +1486,7 @@ my_ulonglong STDCALL mysql_insert_id(MYSQL *mysql) const char *STDCALL mysql_sqlstate(MYSQL *mysql) { - return mysql->net.sqlstate; + return mysql ? mysql->net.sqlstate : cant_connect_sqlstate; } uint STDCALL mysql_warning_count(MYSQL *mysql) -- cgit v1.2.1