summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rw-r--r--client/mysqldump.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/client/mysqldump.c b/client/mysqldump.c
index 3458f74d8a2..b6e1be2cddd 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -1768,6 +1768,8 @@ static void dumpTable(uint numFields, char *table)
for (i = 0; i < mysql_num_fields(res); i++)
{
int is_blob;
+ ulong length= lengths[i];
+
if (!(field = mysql_fetch_field(res)))
{
my_snprintf(query, QUERY_LENGTH,
@@ -1777,7 +1779,7 @@ static void dumpTable(uint numFields, char *table)
error= EX_CONSCHECK;
goto err;
}
-
+
/*
63 is my_charset_bin. If charsetnr is not 63,
we have not a BLOB but a TEXT column.
@@ -1792,7 +1794,6 @@ static void dumpTable(uint numFields, char *table)
field->type == FIELD_TYPE_TINY_BLOB)) ? 1 : 0;
if (extended_insert)
{
- ulong length = lengths[i];
if (i == 0)
dynstr_set(&extended_row,"(");
else
@@ -1882,19 +1883,19 @@ static void dumpTable(uint numFields, char *table)
{
print_xml_tag1(md_result_file, "\t\t", "field name=",
field->name, "");
- print_quoted_xml(md_result_file, row[i], lengths[i]);
+ print_quoted_xml(md_result_file, row[i], length);
fputs("</field>\n", md_result_file);
}
- else if (opt_hex_blob && is_blob)
+ else if (opt_hex_blob && is_blob && length)
{
/* sakaik got the idea to to provide blob's in hex notation. */
- char *ptr= row[i], *end= ptr+ lengths[i];
+ char *ptr= row[i], *end= ptr + length;
fputs("0x", md_result_file);
for (; ptr < end ; ptr++)
fprintf(md_result_file, "%02X", *((uchar *)ptr));
}
else
- unescape(md_result_file, row[i], lengths[i]);
+ unescape(md_result_file, row[i], length);
}
else
{