Merge lp:~linuxjedi/mydumper/trunk-bug-770720 into lp:~mydumper/mydumper/trunk

Proposed by Andrew Hutchings
Status: Merged
Approved by: Andrew Hutchings
Approved revision: 64
Merged at revision: 64
Proposed branch: lp:~linuxjedi/mydumper/trunk-bug-770720
Merge into: lp:~mydumper/mydumper/trunk
Diff against target: 27 lines (+16/-1)
1 file modified
mydumper.c (+16/-1)
To merge this branch: bzr merge lp:~linuxjedi/mydumper/trunk-bug-770720
Reviewer Review Type Date Requested Status
MySQL Data Dumper Team Pending
Review via email: mp+59031@code.launchpad.net

Description of the change

Hex blob/binary output so it is human readable and doesn't corrupt dumps.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'mydumper.c'
2--- mydumper.c 2011-04-21 20:52:39 +0000
3+++ mydumper.c 2011-04-26 09:11:06 +0000
4@@ -816,7 +816,22 @@
5 if (!row[i]) {
6 g_string_append(statement, "NULL");
7 } else if (fields[i].flags & NUM_FLAG) {
8- g_string_append_printf(statement,"\"%s\"", row[i]);
9+ g_string_append(statement, row[i]);
10+ } else if ((fields[i].charsetnr == 63) &&
11+ (fields[i].type == MYSQL_TYPE_BIT ||
12+ fields[i].type == MYSQL_TYPE_STRING ||
13+ fields[i].type == MYSQL_TYPE_VAR_STRING ||
14+ fields[i].type == MYSQL_TYPE_VARCHAR ||
15+ fields[i].type == MYSQL_TYPE_BLOB ||
16+ fields[i].type == MYSQL_TYPE_LONG_BLOB ||
17+ fields[i].type == MYSQL_TYPE_MEDIUM_BLOB ||
18+ fields[i].type == MYSQL_TYPE_TINY_BLOB)) {
19+ /* Convert BLOB/BINARY to hex for human readable dumps
20+ Also, please god find a nicer way of writing the above */
21+ g_string_set_size(escaped, lengths[i]*2+1);
22+ mysql_hex_string(escaped->str, row[i], lengths[i]);
23+ g_string_append(statement, "0x");
24+ g_string_append(statement, escaped->str);
25 } else {
26 /* We reuse buffers for string escaping, growing is expensive just at the beginning */
27 g_string_set_size(escaped, lengths[i]*2+1);

Subscribers

People subscribed via source and target branches