[TYPO3-dev] DBAL documentation...

Martin Kutschker martin.kutschker-n0spam at no5pam-blackbox.net
Sun Sep 9 12:15:35 CEST 2007


ries van Twisk schrieb:
> Hey Guys,
> 
> when I create extensions I often create my tables by hand.
> 
> This is how such a table looks like :
> 
> CREATE TABLE tbl_press_releases (
>        uid integer NOT NULL AUTO_INCREMENT,
>      pid integer NOT NULL,
>      cruser_id integer NOT NULL,
>      deleted integer NOT NULL,
>      hidden integer NOT NULL,
>      tstamp integer NOT NULL,
>      crdate integer NOT NULL,
>      release_type integer NOT NULL,
>      release_date integer
>      fe_user_uid INTEGER NOT NULL,
>      be_user_uid INTEGER NOT NULL,
>      organisation TEXT NOT NULL,
>      name TEXT NOT NULL,
>      contact_mail TEXT NOT NULL,
>      contact_phone TEXT NOT NULL,
>      title TEXT NOT NULL,
>      description_short TEXT NOT NULL,
>      description_long TEXT NOT NULL,
>      city TEXT NOT NULL,
>      country TEXT NOT NULL,
>      approved integer NOT NULL,
>      approved_by TEXT NOT NULL,
>      link TEXT NOT NULL,
>      image TEXT NOT NULL,
>      PRIMARY KEY (uid)
> );
> 
> 
> 
> Now in the BE when I want to install my extension and the table does 
> exists I get loads of changes,
> here are a couple of examples:
> 
> ALTER TABLE tbl_press_releases CHANGE pid pid integer NOT NULL default 0;
>      Current value: int(11) default '0
> 
> Why does TYPO3 create int(11) in the databases while I specify integer.
> I found using int(11) highly confusing since it does suggest an integer 
> with length 11 character
> while in fact it's not and only does something with space padding.

It's the column with in the Mysql shell.

> One other problem I noticed is that when I define a compound key then TYPO3
> keeps on wanting to add that key to the database, while in fact it was 
> already been added.

Please, file a bug (this is not a DBAL bug).

> Now I want to change my SQL to the correct TYPO3 format, but
> I have a hard time understanding what is standard. I know
> once it has been said 'TYPO3 follows a subset of mysql' but that doesn't 
> tell
> me much how I nee to define my SQL's. Normally I don't care much because 
> 95%
> of teh extension I create a private and are for no use of teh community.
> But in this case I might want to publish the extension to TER. And want 
> to conform to something.
> 
> Any pointer to DBAL docs?

What has this to do with DBAL? It's the installer and t3libs SQL parsers 
that do all that stuff.

Anyway, I don't know if the SQL alterations are documented.

Masi




More information about the TYPO3-dev mailing list