summaryrefslogtreecommitdiff
path: root/sql/sql_db.cc
diff options
context:
space:
mode:
authorHe Zhenxing <zhenxing.he@sun.com>2009-05-30 21:32:28 +0800
committerHe Zhenxing <zhenxing.he@sun.com>2009-05-30 21:32:28 +0800
commitabf5f8dac2a0840687dc99816cbd68fb8c515e50 (patch)
treea2efff0bf717227dce4199d6e283e4a7c112dfdd /sql/sql_db.cc
parent88e84c1fbfe9b60eeb9c3d24745ee31cfe29c38b (diff)
downloadmariadb-git-abf5f8dac2a0840687dc99816cbd68fb8c515e50.tar.gz
BUG#41948 Query_log_event constructor needlessly contorted
Make the caller of Query_log_event, Execute_load_log_event constructors and THD::binlog_query to provide the error code instead of having the constructors to figure out the error code. sql/log_event.cc: Changed constructors of Query_log_event and Execute_load_log_event to accept the error code argument instead of figuring it out by itself sql/log_event.h: Changed constructors of Query_log_event and Execute_load_log_event to accept the error code argument
Diffstat (limited to 'sql/sql_db.cc')
-rw-r--r--sql/sql_db.cc15
1 files changed, 9 insertions, 6 deletions
diff --git a/sql/sql_db.cc b/sql/sql_db.cc
index 5a266c3fac9..7f77e60138b 100644
--- a/sql/sql_db.cc
+++ b/sql/sql_db.cc
@@ -181,8 +181,7 @@ uchar* dboptions_get_key(my_dbopt_t *opt, size_t *length,
static inline void write_to_binlog(THD *thd, char *query, uint q_len,
char *db, uint db_len)
{
- Query_log_event qinfo(thd, query, q_len, 0, 0, THD::NOT_KILLED);
- qinfo.error_code= 0;
+ Query_log_event qinfo(thd, query, q_len, 0, 0, 0);
qinfo.db= db;
qinfo.db_len= db_len;
mysql_bin_log.write(&qinfo);
@@ -723,8 +722,9 @@ int mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create_info,
if (mysql_bin_log.is_open())
{
+ int errcode= query_error_code(thd, TRUE);
Query_log_event qinfo(thd, query, query_length, 0,
- /* suppress_use */ TRUE, THD::NOT_KILLED);
+ /* suppress_use */ TRUE, errcode);
/*
Write should use the database being created as the "current
@@ -811,8 +811,9 @@ bool mysql_alter_db(THD *thd, const char *db, HA_CREATE_INFO *create_info)
if (mysql_bin_log.is_open())
{
+ int errcode= query_error_code(thd, TRUE);
Query_log_event qinfo(thd, thd->query, thd->query_length, 0,
- /* suppress_use */ TRUE, THD::NOT_KILLED);
+ /* suppress_use */ TRUE, errcode);
/*
Write should use the database being created as the "current
@@ -958,8 +959,9 @@ bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent)
}
if (mysql_bin_log.is_open())
{
+ int errcode= query_error_code(thd, TRUE);
Query_log_event qinfo(thd, query, query_length, 0,
- /* suppress_use */ TRUE, THD::NOT_KILLED);
+ /* suppress_use */ TRUE, errcode);
/*
Write should use the database being created as the "current
database" and not the threads current database, which is the
@@ -1958,8 +1960,9 @@ bool mysql_upgrade_db(THD *thd, LEX_STRING *old_db)
/* Step8: logging */
if (mysql_bin_log.is_open())
{
+ int errcode= query_error_code(thd, TRUE);
Query_log_event qinfo(thd, thd->query, thd->query_length,
- 0, TRUE, THD::NOT_KILLED);
+ 0, TRUE, errcode);
thd->clear_error();
mysql_bin_log.write(&qinfo);
}