1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Fix values printed by mysqldump for empty blob fields when

--hex-blob is used. (Bug #13318)


client/mysqldump.c:
  Don't use 0x... syntax for empty fields.
mysql-test/r/mysqldump.result:
  Add new results
mysql-test/t/mysqldump.test:
  Add new regression test
This commit is contained in:
unknown
2005-11-23 17:31:44 -08:00
parent c8067ec848
commit eb92d6a1e3
3 changed files with 79 additions and 6 deletions

View File

@ -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
{