List:Commits« Previous MessageNext Message »
From:ramil Date:May 4 2006 12:34pm
Subject:bk commit into 4.1 tree (ramil:1.2476) BUG#18351
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of ram. When ram 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.2476 06/05/04 15:34:20 ramil@stripped +1 -0
  Fix for bug #18351: mysqlbinlog does not set default charset?
  

  client/mysqlbinlog.cc
    1.108 06/05/04 15:34:13 ramil@stripped +17 -0
    Fix for bug #18351: mysqlbinlog does not set default charset?
      - --set-charset option added to allow one deal with old binlog files.
        It adds 'SET NAMES charset' to the output.

# 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:	ramil
# Host:	myoffice.izhnet.ru
# Root:	/usr/home/ram/work/4.1.b18351

--- 1.107/client/mysqlbinlog.cc	2005-12-04 17:32:54 +04:00
+++ 1.108/client/mysqlbinlog.cc	2006-05-04 15:34:13 +05:00
@@ -53,6 +53,7 @@ static int port = MYSQL_PORT;
 static const char* sock= 0;
 static const char* user = 0;
 static char* pass = 0;
+static char *charset= 0;
 
 static ulonglong start_position, stop_position;
 #define start_position_mot ((my_off_t)start_position)
@@ -481,6 +482,9 @@ static struct my_option my_long_options[
    "Used to reserve file descriptors for usage by this program",
    (gptr*) &open_files_limit, (gptr*) &open_files_limit, 0, GET_ULONG,
    REQUIRED_ARG, MY_NFILE, 8, OS_FILE_LIMIT, 0, 1, 0},
+  {"set-charset", OPT_SET_CHARSET,
+   "Add 'SET NAMES character_set' to the output.", (gptr*) &charset,
+   (gptr*) &charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"short-form", 's', "Just show the queries, no extra info.",
    (gptr*) &short_form, (gptr*) &short_form, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
    0, 0},
@@ -1095,6 +1099,13 @@ int main(int argc, char** argv)
     fprintf(result_file,
             "/*!32316 SET @OLD_SQL_LOG_BIN=@@SQL_LOG_BIN, SQL_LOG_BIN=0*/;\n");
 
+  if (charset)
+    fprintf(result_file,
+            "\n/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;"
+            "\n/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;"
+            "\n/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;"  
+            "\n/*!40101 SET NAMES %s */;\n", charset);
+
   for (save_stop_position= stop_position, stop_position= ~(my_off_t)0 ;
        (--argc >= 0) && !stop_passed ; )
   {
@@ -1111,6 +1122,12 @@ int main(int argc, char** argv)
 
   if (disable_log_bin)
     fprintf(result_file, "/*!32316 SET SQL_LOG_BIN=@OLD_SQL_LOG_BIN*/;\n");
+
+  if (charset)
+    fprintf(result_file,
+            "/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;\n"
+            "/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;\n"
+            "/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;\n");
 
   if (tmpdir.list)
     free_tmpdir(&tmpdir);
Thread
bk commit into 4.1 tree (ramil:1.2476) BUG#18351ramil4 May