diff options
author | Guilhem Bichot <guilhem@mysql.com> | 2009-09-30 12:25:50 +0200 |
---|---|---|
committer | Guilhem Bichot <guilhem@mysql.com> | 2009-09-30 12:25:50 +0200 |
commit | 12e822039d5dde7eda9f701323ff3b7b6c36bc29 (patch) | |
tree | ed4d4bd9316c084770e810815274ca29e6434ffb /sql-common | |
parent | ccae404afaddf98c16889fdd21c613b551ee5e5e (diff) | |
download | mariadb-git-12e822039d5dde7eda9f701323ff3b7b6c36bc29.tar.gz |
Fix for BUG#42980 "Client doesn't set NUM_FLAG for DECIMAL and TIMESTAMP":
DECIMAL and TIMESTAMP used to have NUM_FLAG, but NEWDECIMAL was forgotten.
It's correct that TIMESTAMP does not have the flag nowadays (manual will be updated, connectors
developers will be notified).
client/mysqldump.c:
IS_NUM_FIELD(f) removed and replaced by its definition (f>flags & NUM_FLAG).
include/mysql.h:
- IS_NUM_FIELD() is removed because name is too close to IS_NUM() and it is not used a lot
- INTERNAL_NUM_FIELD() is removed:
* it forgets to test NEWDECIMAL (when IS_NUM() was updated for NEWDECIMAL we forgot
to update INTERNAL_NUM_FIELD()), that's why client didn't mark NEWDECIMAL with NUM_FLAG (a bug).
* it has an obsolete test for length of the TIMESTAMP field: test became accidentally wrong when length
of TIMESTAMP was changed to always be 19 (when the format was changed from YYYYMMDDhhmmss to
YYYY-MM-DD hh:mm:ss), never 8 or 14 anymore. That obsolete test caused TIMESTAMP to lose NUM_FLAG,
which was an accidental but good change (see below).
* IS_NUM() should be used instead
- IS_NUM(f) is changed: TIMESTAMP used to be parsable as a number without quotes (when it was formatted as
"YYYYMMDDhhmmss"); but it is not anymore (now that it is "YYYY-MM-DD hh:mm:ss"), so it should not have NUM_FLAG
(mysqldump needs to quote TIMESTAMP values), so IS_NUM() should return false for it.
libmysqld/lib_sql.cc:
use IS_NUM() instead of INTERNAL_NUM_FIELD()
mysql-test/r/bigint.result:
result change: NEWDECIMAL fields now have NUM_FLAG (32768)
mysql-test/r/metadata.result:
result change: NEWDECIMAL fields now have NUM_FLAG (32768)
mysql-test/r/mysqldump.result:
DECIMAL columns are not quoted anymore by mysqldump. Which is ok, the parser does not need '' for them
mysql-test/r/ps_2myisam.result:
result change: NEWDECIMAL fields now have NUM_FLAG (32768)
mysql-test/r/ps_3innodb.result:
result change: NEWDECIMAL fields now have NUM_FLAG (32768)
mysql-test/r/ps_4heap.result:
result change: NEWDECIMAL fields now have NUM_FLAG (32768)
mysql-test/r/ps_5merge.result:
result change: NEWDECIMAL fields now have NUM_FLAG (32768)
mysql-test/suite/ndb/r/ps_7ndb.result:
result change: NEWDECIMAL fields now have NUM_FLAG (32768)
mysql-test/t/metadata.test:
test for BUG#42980
sql-common/client.c:
use IS_NUM() instead of INTERNAL_NUM_FIELD()
Diffstat (limited to 'sql-common')
-rw-r--r-- | sql-common/client.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sql-common/client.c b/sql-common/client.c index 84029b449af..a502e0ea195 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -1313,7 +1313,7 @@ unpack_fields(MYSQL_DATA *data,MEM_ROOT *alloc,uint fields, field->flags= uint2korr(pos+7); field->decimals= (uint) pos[9]; - if (INTERNAL_NUM_FIELD(field)) + if (IS_NUM(field->type)) field->flags|= NUM_FLAG; if (default_value && row->data[7]) { @@ -1354,7 +1354,7 @@ unpack_fields(MYSQL_DATA *data,MEM_ROOT *alloc,uint fields, field->flags= (uint) (uchar) row->data[4][0]; field->decimals=(uint) (uchar) row->data[4][1]; } - if (INTERNAL_NUM_FIELD(field)) + if (IS_NUM(field->type)) field->flags|= NUM_FLAG; if (default_value && row->data[5]) { |