diff options
Diffstat (limited to 'libmysqld/lib_sql.cc')
-rw-r--r-- | libmysqld/lib_sql.cc | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc index d6f77e68183..d278bd39834 100644 --- a/libmysqld/lib_sql.cc +++ b/libmysqld/lib_sql.cc @@ -44,12 +44,13 @@ extern unsigned int mysql_server_last_errno; extern char mysql_server_last_error[MYSQL_ERRMSG_SIZE]; static my_bool emb_read_query_result(MYSQL *mysql); static void emb_free_embedded_thd(MYSQL *mysql); - +static bool embedded_print_errors= 0; extern "C" void unireg_clear(int exit_code) { DBUG_ENTER("unireg_clear"); - clean_up(!opt_help && (exit_code || !opt_bootstrap)); /* purecov: inspected */ + embedded_print_errors= 0; + clean_up(!opt_help && !exit_code); /* purecov: inspected */ clean_up_mutexes(); my_end(opt_endinfo ? MY_CHECK_ERROR | MY_GIVE_INFO : 0); DBUG_VOID_RETURN; @@ -518,6 +519,7 @@ int init_embedded_server(int argc, char **argv, char **groups) const char *fake_groups[] = { "server", "embedded", 0 }; my_bool acl_error; + embedded_print_errors= 1; if (my_thread_init()) return 1; @@ -1336,8 +1338,17 @@ int vprint_msg_to_log(enum loglevel level __attribute__((unused)), const char *format, va_list argsi) { vsnprintf(mysql_server_last_error, sizeof(mysql_server_last_error), - format, argsi); + format, argsi); mysql_server_last_errno= CR_UNKNOWN_ERROR; + if (embedded_print_errors && level == ERROR_LEVEL) + { + /* The following is for testing when someone removes the above test */ + const char *tag= (level == ERROR_LEVEL ? "ERROR" : + level == WARNING_LEVEL ? "Warning" : + "Note"); + fprintf(stderr,"Got %s: \"%s\" errno: %d\n", + tag, mysql_server_last_error, mysql_server_last_errno); + } return 0; } |