summaryrefslogtreecommitdiff
path: root/sql/sql_insert.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_insert.cc
parenta99c1757be3ad053437a494442774227d61defbe (diff)
downloadmariadb-git-751f2d1f160a6ba6be4ee93ddf308f552527c254.tar.gz
Faster log::write() call, memory leak fix, flush master fix.
Diffstat (limited to 'sql/sql_insert.cc')
-rw-r--r--sql/sql_insert.cc27
1 files changed, 18 insertions, 9 deletions
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index bd0415aa936..13feba9ab9c 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -246,9 +246,12 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, List<Item> &fields,
id=table->next_number_field->val_int(); // Return auto_increment value
if (info.copied || info.deleted)
{
- 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);
+ }
}
error=ha_autocommit_or_rollback(thd,error);
if (thd->lock)
@@ -1085,9 +1088,12 @@ bool delayed_insert::handle_inserts(void)
}
if (row->query && row->log_query)
{
- mysql_update_log.write(row->query, row->query_length);
- Query_log_event qinfo(&thd, row->query);
- mysql_bin_log.write(&qinfo);
+ mysql_update_log.write(&thd,row->query, row->query_length);
+ if (mysql_bin_log.is_open())
+ {
+ Query_log_event qinfo(&thd, row->query);
+ mysql_bin_log.write(&qinfo);
+ }
}
if (table->blob_fields)
free_delayed_insert_blobs(table);
@@ -1245,9 +1251,12 @@ bool select_insert::send_eof()
if (last_insert_id)
thd->insert_id(last_insert_id); // For update log
::send_ok(&thd->net,info.copied,last_insert_id,buff);
- 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);
+ }
return 0;
}
}