Wrong number format on ZEROFILL Integers

[expired user #8405]'s profile image [expired user #8405] posted 8 years ago in General Permalink

Hello,

if i use the national number format, the integer will be displayed with tousend seperators. That's a nice feature. But if i have a ZEROFILL integer, this will be ignored to display.

CREATE TABLE test ( test SMALLINT(4) UNSIGNED ZEROFILL NULL DEFAULT NULL ) ENGINE=MyISAM ;

INSERT INTO test (test) values (0), (999), (1000), (1999);

Now the table for german (tousend seperator is . and decimal point is ,) shows:

test

0000 0999 1.000 1.999

that's wrong! I would say if the ZEROFILL is defined, no national formats are used (first two lines)!

Martin

ansgar's profile image ansgar posted 8 years ago Permalink

that's wrong! I would say if the ZEROFILL is defined, no national formats are used

That's just one opinion. There is no wrong or right in this case, probably preferred or non-intuitive usability.

ansgar's profile image ansgar posted 8 years ago Permalink

Or do you mean that 0099 should display 0.099 instead ? I guess that's what you meant, did you?

[expired user #8405]'s profile image [expired user #8405] posted 8 years ago Permalink

I would say if the ZEROFILL is defined, no national formats are used

That's just one opinion. There is no wrong or right in this case, probably preferred or non-intuitive usability.

Yes you are right. So i write "i would say".

Or do you mean that 0099 should display 0.099 instead ? I guess that's what you meant, did you?

Yes, you have two ways:

  • 0999 and 1999 or
  • 0.999 and 1.999.

The mix with 0999 and 1.999 is wrong!

ansgar's profile image ansgar posted 8 years ago Permalink

Yes, agree.

kalvaro's profile image kalvaro posted 8 years ago Permalink

IMHO, as soon as you want leading zeroes to be relevant your number is no longer a number and becomes an alphanumeric code. (In fact, I suppose the underlying API must be returning strings.) If you ask me, I'd vote for skipping national format.

Please login to leave a reply, or register at first.