db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Xavier Maysonnave <xav...@omondo.com>
Subject Re: sql/base/mysql/unique.vm
Date Fri, 17 Oct 2003 07:53:49 GMT
Oops,

I did a mistake.
You are right it works fine.

I fact I modified the Torque code to retrieve and generate the index contained in a database.
The problem I face was due to a mismatch with primary indexes.
In mysql and probably in other databases primary indexes are also seen as an index.
Here is an example :

    <table name="phpbb_config">
       <column name="config_name" primaryKey="true" type="VARCHAR" size="255" 
required="true"/>
       <column name="config_value" type="VARCHAR" size="255" required="true"/>
       <index name="PRIMARY">
          <index-column name="config_name" position="1" direction="A"/>
       </index>
    </table>

When I generate the SQL I got the following result :

drop table if exists phpbb_config;

CREATE TABLE phpbb_config (
     config_name VARCHAR (255) NOT NULL,
     config_value VARCHAR (255) NOT NULL,
     PRIMARY KEY(config_name),
     INDEX PRIMARY (config_name)
);

The error I got came from that problem.

If you think it's interresting I would be pleased to contribute the code I wrote to 
generate indexes.

Regards.

Daniel Rall wrote:

> Xavier Maysonnave wrote:
> 
>> The default template is the following :
>>
>> #foreach ($unique in $table.Unices)
>>     UNIQUE ($unique.ColumnList),
>> #end
>>
>> This doesn't work, It should rather be :
>>
>> #foreach ($unique in $table.Unices)
>>     UNIQUE $unique.Name ($unique.ColumnList),
>> #end
> 
> 
> 
> It works fine with MySQL 3.23.x and 4.0.x (MySQL creates an index of the 
> same name, as shown by "SHOW INDEX FROM [table name]").  What 
> database/version are you seeing problems with?
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-dev-help@db.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


Mime
View raw message