List:Internals« Previous MessageNext Message »
From:Sasha Pachev Date:December 7 2005 2:57am
Subject:bk commit into 5.0 tree (sasha:1.1979) BUG#11312
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of sasha. When sasha does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.1979 05/12/06 19:57:06 sasha@stripped +1 -0
  fix for BUG#11312 (DELIMITER not showing in the output of mysqlbinlog)

  client/mysqlbinlog.cc
    1.124 05/12/06 19:57:00 sasha@stripped +54 -2
    fix for BUG#11312 (DELIMITER not showing in the output of mysqlbinlog)

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	sasha
# Host:	mysql.sashanet.com
# Root:	/reiser-data/mysql-dev/mysql-5.0-bug11312

--- 1.123/client/mysqlbinlog.cc	2005-12-04 11:55:14 -07:00
+++ 1.124/client/mysqlbinlog.cc	2005-12-06 19:57:00 -07:00
@@ -98,7 +98,9 @@
 static int dump_remote_file(NET* net, const char* fname);
 static void die(const char* fmt, ...);
 static MYSQL* safe_connect();
-
+static int print_open_delim(Query_log_event* ev);
+static void print_close_delim(int delim_count);
+static void print_repeat_char(char c, int count);
 
 class Load_log_processor
 {
@@ -472,6 +474,51 @@
          strcmp(log_dbname, database);
 }
 
+static int print_open_delim(Query_log_event* ev)
+{
+  int max_delim_count= 0,cur_delim_count= 0;
+  const char* query_p;
+  const char* query_end;
+  query_p= ev->query;
+  query_end= query_p + ev->q_len;
+  for (; query_p < query_end; query_p++)
+  {
+    switch (*query_p)
+    {
+    case ';':
+      cur_delim_count++;
+      break;
+    case '\r':
+    case '\n':
+      set_if_bigger(max_delim_count,cur_delim_count);
+      break;    
+    default:
+      cur_delim_count= 0;
+      break;  
+    }
+  }
+  
+  if (max_delim_count)
+  {
+    fprintf(result_file,"DELIMITER ;");
+    print_repeat_char(';',max_delim_count);
+    fputc('\n',result_file);  
+  }
+  return max_delim_count;
+}
+
+static void print_repeat_char(char c, int count)
+{
+ for (;count;count--)
+   fputc(c,result_file);
+}
+
+static void print_close_delim(int delim_count)
+{
+  print_repeat_char(';',delim_count);
+  fprintf(result_file,"\nDELIMITER ;\n");
+}
+
 
 /*
   Process an event
@@ -534,7 +581,12 @@
     case QUERY_EVENT:
       if (check_database(((Query_log_event*)ev)->db))
         goto end;
-      ev->print(result_file, print_event_info);
+      { 
+        int delim_count= print_open_delim((Query_log_event*)ev);  
+        ev->print(result_file, print_event_info);
+        if (delim_count)
+          print_close_delim(delim_count+1);
+      }
       break;
     case CREATE_FILE_EVENT:
     {
Thread
bk commit into 5.0 tree (sasha:1.1979) BUG#11312Sasha Pachev7 Dec