[TYPO3-dev] ext_tables.sql - signed integer field syntax
Jigal van Hemert
jigal at xs4all.nl
Thu Jun 23 12:05:26 CEST 2011
Hi,
On 23-6-2011 11:18, Fabien Udriot wrote:
> I would like to have a "signed" field and therefore I put this in
> ext_tables.sql
>
> number int(11) signed DEFAULT '0' NOT NULL,
>
> The field is correctly set to "signed" but then the Extension Manager is
> moaning that the field must be changed as if the syntax would not be
> recognized.
'signed' is not a keyword which can be used in that location (it is not
a reserved word at all for MySQL).
You can use:
INT[(length)] [UNSIGNED] [ZEROFILL]
for the data type part and
[NOT NULL | NULL] [DEFAULT default_value] [AUTO_INCREMENT] .....
(see [1]) after that as a column definition.
Integer fields are signed by default in MySQL.
> BTW, is this "syntax" documented somewhere? I didn't find much in the
> doc_core_*. The best I could spot is some example in "doc_core_inside"
It's in t3lib_install::getFieldDefinitions_database(). It basically
performs a
SHOW COLUMNS FROM table_name
query. From the result the 'Type' field is used.
If the 'Null' field equals 'NO' "NOT NULL" is added.
If the type is not a 'blob' or 'text' and no 'auto_increment' is set,
"default 'default_value'" is added
If the 'Extra' field is filled that is added to.
After that the keys (indexes) are added followd by the engine and collation.
This is compared with the definition in the extensions ext_tables.sql
file by t3lib_install::getDatabaseExtra()
--
Kind regards / met vriendelijke groet,
Jigal van Hemert.
More information about the TYPO3-dev
mailing list