mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Fix for the bugs:
#2005 Long decimal comparion bug. #2055 mysqldump should replace "-inf" numeric field values with "NULL"
This commit is contained in:
@ -1067,10 +1067,22 @@ static void dumpTable(uint numFields, char *table)
|
||||
}
|
||||
else
|
||||
{
|
||||
/* change any strings ("inf","nan",..) into NULL */
|
||||
/* change any strings ("inf", "-inf", "nan") into NULL */
|
||||
char *ptr = row[i];
|
||||
dynstr_append(&extended_row,
|
||||
(!isalpha(*ptr)) ? ptr : "NULL");
|
||||
if (isalpha(*ptr) || (*ptr == '-' && *(ptr+1) == 'i'))
|
||||
dynstr_append(&extended_row, "NULL");
|
||||
else
|
||||
{
|
||||
if (field->type == FIELD_TYPE_DECIMAL)
|
||||
{
|
||||
/* add " signs around */
|
||||
dynstr_append(&extended_row, "\"");
|
||||
dynstr_append(&extended_row, ptr);
|
||||
dynstr_append(&extended_row, "\"");
|
||||
}
|
||||
else
|
||||
dynstr_append(&extended_row, ptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -1098,13 +1110,25 @@ static void dumpTable(uint numFields, char *table)
|
||||
}
|
||||
else
|
||||
{
|
||||
/* change any strings ("inf","nan",..) into NULL */
|
||||
/* change any strings ("inf", "-inf", "nan") into NULL */
|
||||
char *ptr = row[i];
|
||||
if (opt_xml)
|
||||
fprintf(md_result_file, "\t\t<field name=\"%s\">%s</field>\n",
|
||||
field->name,!isalpha(*ptr) ?ptr: "NULL");
|
||||
else if (isalpha(*ptr) || (*ptr == '-' && *(ptr+1) == 'i'))
|
||||
fputs("NULL", md_result_file);
|
||||
else
|
||||
fputs((!isalpha(*ptr)) ? ptr : "NULL", md_result_file);
|
||||
{
|
||||
if (field->type == FIELD_TYPE_DECIMAL)
|
||||
{
|
||||
/* add " signs around */
|
||||
fputs("\"", md_result_file);
|
||||
fputs(ptr, md_result_file);
|
||||
fputs("\"", md_result_file);
|
||||
}
|
||||
else
|
||||
fputs(ptr, md_result_file);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -8,3 +8,22 @@ CREATE TABLE t1(a int);
|
||||
INSERT INTO t1 VALUES (1), (2);
|
||||
--exec $MYSQL_DUMP -X test t1
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug #2005
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (a decimal(240, 20));
|
||||
INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890"),
|
||||
("0987654321098765432109876543210987654321");
|
||||
--exec $MYSQL_DUMP test t1
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug #2055
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (a double);
|
||||
INSERT INTO t1 VALUES (-9e999999);
|
||||
--exec $MYSQL_DUMP test t1
|
||||
DROP TABLE t1;
|
||||
|
Reference in New Issue
Block a user