[Typo3-dev] Incorrect SQL when creating tables using ext_tables.sql

Ries van Twisk typo3 at rvt.dds.nl
Thu Apr 21 17:54:28 CEST 2005


Michael,

I think when supplying my origional table and the generated table in the 
mail was enough...
I try to clarify a bit more (but with a more simple table).

It's about installing a extention, and the extention manager re-writes 
my tables code...

When my ext_tables.sql file contains a table that looks like this:

CREATE TABLE ip4_0
( 
    b tinyint UNSIGNED NOT NULL,
);

Then the extention manager rewrites it to:
CREATE TABLE ip4_0 (
( ,
                b tinyint UNSIGNED NOT NULL, -- second byte of quad
) TYPE=MyISAM;

As you can see, a extra line with  ( , is intruduced.

I tracked down the problem to this:
When the  ( is placed on the second line, then the extra ( , is 
introduced on the second line, a ( is placed directly after my tablename,
When the ( is placed directly after the table name, then everything is ok.

I am currently importing a data from a other system to keep them in sinc 
(about 260 tables with 800.000 records).
and I just 'took' the SQL from the other system.

I hope that clarifies things more...

cheers,
Ries





>Hi Ries,
>
>if you rewrite your mail in a more readable form then I will probably find
>out what your problem is. But for now I have no idea...
>
>(see below)
>
>- michael
>
>  
>
>>when I create a ext_tables.sql file in my extention then my sql is
>>rewritten (obviosly) but also incorrect SQL is created.
>>Here is a example:
>>
>>This is the created SQL
>>CREATE TABLE ip4_0 (
>>( ,
>>b tinyint UNSIGNED NOT NULL, -- second byte of quad,
>>c tinyint UNSIGNED NOT NULL, -- third byte of quad,
>>country smallint UNSIGNED NOT NULL, -- <65536 countries,
>>city smallint UNSIGNED NOT NULL, -- <65536 cities,
>>cron TIMESTAMP NOT NULL,
>>KEY kCountry(country) ,
>>KEY kCity(city) ,
>>KEY kb(b) ,
>>KEY kc(c) ,
>>KEY kcron(cron)
>>);
>>
>> From this table:
>>CREATE TABLE ip4_0
>>    (
>>    b                tinyint UNSIGNED NOT NULL,        -- second byte of
>>quad
>>    c                tinyint UNSIGNED NOT NULL,        -- third byte of
>>    quad
>>    country            smallint UNSIGNED NOT NULL,        -- <65536
>>countries
>>    city            smallint UNSIGNED NOT NULL,        -- <65536 cities
>>    cron            TIMESTAMP NOT NULL,
>>    KEY                kCountry(country),
>>    KEY                kCity(city),
>>    KEY                kb(b),
>>    KEY                kc(c),
>>    KEY                kcron(cron)
>>    );
>>
>>My first thought is that the SQL parser 'expects' a autonumbering field,
>>Can anybody confirm this?
>>
>>Is there any workaround to this???
>>
>>cheers,
>>Ries
>>
>>
>>
>>    
>>
>
>  
>


-- 
R. van Twisk
http://www.metamorf.net

Our Typo3 enabled website: http://www.livetravelguides.com
Instand help for Typo3?    irc:/irc.freenode.net/typo3
Looking for documentation? http://typo3.org/documentation/






More information about the TYPO3-dev mailing list