summaryrefslogtreecommitdiff
path: root/sql/sql_db.cc
diff options
context:
space:
mode:
authormonty@donna.mysql.com <>2000-09-16 04:27:21 +0300
committermonty@donna.mysql.com <>2000-09-16 04:27:21 +0300
commit751f2d1f160a6ba6be4ee93ddf308f552527c254 (patch)
tree6e20280a8abcc28d14385983250a3e1823639028 /sql/sql_db.cc
parenta99c1757be3ad053437a494442774227d61defbe (diff)
downloadmariadb-git-751f2d1f160a6ba6be4ee93ddf308f552527c254.tar.gz
Faster log::write() call, memory leak fix, flush master fix.
Diffstat (limited to 'sql/sql_db.cc')
-rw-r--r--sql/sql_db.cc20
1 files changed, 13 insertions, 7 deletions
diff --git a/sql/sql_db.cc b/sql/sql_db.cc
index 33c8ee54037..5c816aa8dc5 100644
--- a/sql/sql_db.cc
+++ b/sql/sql_db.cc
@@ -71,9 +71,12 @@ void mysql_create_db(THD *thd, char *db, uint create_options)
path);
}
{
- mysql_update_log.write(thd->query, thd->query_length);
- Query_log_event qinfo(thd, thd->query);
- mysql_bin_log.write(&qinfo);
+ mysql_update_log.write(thd,thd->query, thd->query_length);
+ if (mysql_bin_log.is_open())
+ {
+ Query_log_event qinfo(thd, thd->query);
+ mysql_bin_log.write(&qinfo);
+ }
}
if (thd->query == path)
{
@@ -131,9 +134,12 @@ void mysql_rm_db(THD *thd,char *db,bool if_exists)
thd->query_length = (uint) (strxmov(path,"drop database ", db, NullS)-
path);
}
- mysql_update_log.write(thd->query, thd->query_length);
- Query_log_event qinfo(thd, thd->query);
- mysql_bin_log.write(&qinfo);
+ mysql_update_log.write(thd, thd->query, thd->query_length);
+ if (mysql_bin_log.is_open())
+ {
+ Query_log_event qinfo(thd, thd->query);
+ mysql_bin_log.write(&qinfo);
+ }
if (thd->query == path)
{
thd->query = 0; // just in case
@@ -276,7 +282,7 @@ bool mysql_change_db(THD *thd,const char *name)
thd->priv_user,
thd->host ? thd->host : thd->ip ? thd->ip : "unknown",
dbname);
- mysql_log.write(COM_INIT_DB,ER(ER_DBACCESS_DENIED_ERROR),
+ mysql_log.write(thd,COM_INIT_DB,ER(ER_DBACCESS_DENIED_ERROR),
thd->priv_user,
thd->host ? thd->host : thd->ip ? thd->ip : "unknown",
dbname);