[TYPO3-dev] Default definitions of database fields

Dmitry Dulepov dmitry.dulepov+t3ml at gmail.com
Mon Feb 15 10:36:59 CET 2010


Hi!

On 2010-02-15 10:57:48 +0200, Jochen Rau said:
> Thanks for the addition. But I did not find any hint in the literature 
> according to *integers*. IMO it has no effect to have the same display 
> length as long as the display length is not too short for the content. 
> So, joining int(3) and int(11) should have no relevancy in sense of 
> performance.
> 
> Maybe you can point me to some docs?

I did not read the whole topic, so I appologize if my post duplicates 
somebody's else information. If not, this post may answer some 
questions.

This test from the terminal gives information for the answer:

=======================
Applico:~$ mysql test
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1023
Server version: 5.0.67 Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> create table inttest (intvalue int);
Query OK, 0 rows affected (0.15 sec)

mysql> show create table inttest;
+---------+-------------------------------------------------------------------------------------------------+
| 

Table   | Create Table                                                  
                                  |
+---------+-------------------------------------------------------------------------------------------------+
| 

inttest | CREATE TABLE `inttest` (
  `intvalue` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 |
+---------+-------------------------------------------------------------------------------------------------+
1 

row in set (0.03 sec)

mysql>
=======================

Have a look at my CREATE TABLE and to what actually was created. 11 
bits is a default length that MySQL uses. That's all. TYPO3 SQL parser 
requires an exact match between ext_tables.sql and what MySQL returns 
in response to SHOW CREATE TABLE. So if you omit length specification 
for int, you will always get complaints from TYPO3 SQL parser that 
table is different.

Nothing more magical here. It have been like this for all TYPO3 
history. This is why all definitions have int(11) and not just int.

-- 
Dmitry Dulepov
TYPO3 expert / TYPO3 security team member 
Read more @ http://dmitry-dulepov.com/





More information about the TYPO3-dev mailing list