diff options
author | ramil@mysql.com <> | 2006-05-30 13:16:11 +0500 |
---|---|---|
committer | ramil@mysql.com <> | 2006-05-30 13:16:11 +0500 |
commit | 4df24774c1dcd98ff5da6934c705fd6faccc6b78 (patch) | |
tree | 535a47fccc394d6008a396bb535ddbac4db187ff /client/mysqlbinlog.cc | |
parent | ae72df07f28ee476559d7dbf6ebcc60f85ce4faa (diff) | |
parent | b698a07b1f7709adb312b7a2eb6fa7cd6fedbcac (diff) | |
download | mariadb-git-4df24774c1dcd98ff5da6934c705fd6faccc6b78.tar.gz |
Merge mysql.com:/usr/home/ram/work/mysql-4.1
into mysql.com:/usr/home/ram/work/mysql-5.0
Diffstat (limited to 'client/mysqlbinlog.cc')
-rw-r--r-- | client/mysqlbinlog.cc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index 60b54a2ed99..518ab7cf832 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -71,6 +71,7 @@ static int port= 0; 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) @@ -707,6 +708,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}, @@ -1430,6 +1434,13 @@ int main(int argc, char** argv) "/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE," "COMPLETION_TYPE=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 ; ) { @@ -1454,6 +1465,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); if (result_file != stdout) |