[TYPO3-dev] Default definitions of database fields
Jochen Rau
jochen.rau at typoplanet.de
Fri Feb 12 00:24:56 CET 2010
Hi.
On 11.02.10 18:22, Susanne Moog wrote:
> Am 11.02.2010 17:45, schrieb Jochen Rau:
>> Why do we use (11) after int, tinyint? As this makes perfect sense for
>> char and varchar, it is IMO useless for int and tinyint because it does
>> NOT indicate how many numbers or bytes the field can hold. It just fills
>> the integer up with zeroes on the left. A 42 stored in an int(11) field
>> is stored as 00000000042. (Don't ask why "42" ;-) )
>
> I'm not really shure but if I remember correctly mySQL uses the (11) for
> the size of the field on a temporary join. So you can make temporary
> joins faster with limiting the char count of the chars displayed. I
> don't know if that matters for TYPO3 at all, just thought I remember it
> that way.
Actually the leading "00000" are not stored in the database. Its an
optional display width. The MySQL manual says
---snip
"This optional display width may be used by applications to display
integer values having a width less than the width specified for the
column by left-padding them with spaces. (That is, this width is present
in the metadata returned with result sets. Whether it is used or not is
up to the application.)
The display width does not constrain the range of values that can be
stored in the column, nor the number of digits that are displayed for
values having a width exceeding that specified for the column."
---snip
I think we should allow the developers to drop this information
(currently the EM complaints about this).
Jochen
More information about the TYPO3-dev
mailing list