List:Commits« Previous MessageNext Message »
From:Andrei Elkin Date:January 6 2006 9:03pm
Subject:bk commit into 5.0 tree (aelkin:1.2014)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of elkin. When elkin 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.2014 06/01/06 23:03:35 aelkin@stripped[elkin] +1 -0
  33110_bk.patch

  client/mysqlbinlog.cc
    1.124 05/12/07 04:57:00 aelkin@stripped[elkin] +54 -2
    Import patch 33110_bk.patch

# 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:	aelkin
# Host:	dsl-hkigw8-fe02f800-41.dhcp.inet.fi
# Root:	/usr_rh9/home/elkin.rh9/MySQL/mysql-5.0-bug11312

--- 1.123/client/mysqlbinlog.cc	2005-12-04 20:55:14 +02:00
+++ 1.124/client/mysqlbinlog.cc	2005-12-07 04:57:00 +02: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 (aelkin:1.2014)Andrei Elkin6 Jan