summaryrefslogtreecommitdiff
path: root/libmysqld
diff options
context:
space:
mode:
Diffstat (limited to 'libmysqld')
-rw-r--r--libmysqld/CMakeLists.txt1
-rw-r--r--libmysqld/lib_sql.cc18
2 files changed, 15 insertions, 4 deletions
diff --git a/libmysqld/CMakeLists.txt b/libmysqld/CMakeLists.txt
index 3fd792c408a..f2759f19d7d 100644
--- a/libmysqld/CMakeLists.txt
+++ b/libmysqld/CMakeLists.txt
@@ -113,6 +113,7 @@ SET(SQL_EMBEDDED_SOURCES emb_qcache.cc libmysqld.c lib_sql.cc
../sql/sql_analyze_stmt.cc ../sql/sql_analyze_stmt.h
../sql/compat56.cc
../sql/sql_type.cc ../sql/sql_type.h
+ ../sql/sql_mode.cc
../sql/sql_type_json.cc
../sql/sql_type_geom.cc
../sql/table_cache.cc ../sql/mf_iocache_encr.cc
diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc
index b0fb6054a97..1d5133794d2 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;
@@ -520,7 +521,7 @@ int init_embedded_server(int argc, char **argv, char **groups)
my_bool acl_error;
DBUG_ASSERT(mysql_embedded_init == 0);
-
+ embedded_print_errors= 1;
if (my_thread_init())
return 1;
@@ -1381,8 +1382,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;
}