You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-dev@db.apache.org by "Peter Frühberger (JIRA)" <ji...@apache.org> on 2008/03/14 08:35:24 UTC

[jira] Created: (TORQUE-110) unique name not parsed when generating mysql (sql/base/mysql/unique.vm)

unique name not parsed when generating mysql (sql/base/mysql/unique.vm)
-----------------------------------------------------------------------

                 Key: TORQUE-110
                 URL: https://issues.apache.org/jira/browse/TORQUE-110
             Project: Torque
          Issue Type: Bug
          Components: Maven 1 Plugin
    Affects Versions: 3.3-RC3
         Environment: debian etch linux
            Reporter: Peter Frühberger
            Priority: Minor


The following snippet of code:
<unique name="NAME_IDX">
<unique-column name="NAME"/>    
</unique>

Schema:
<!ELEMENT index (option*,index-column+)>
<!ATTLIST index
  name CDATA #IMPLIED

generates the following mysql code (the name is totally ignored), but the schema allows it.

Create ...
        ...
    UNIQUE (NAME)
);

The unique index name (NAME_IDX) is missing, it should correctly be:

Create ...
        UNIQUE NAME_IDX (NAME);
);


changing the unique.vm in sql/base/mysql/unique.vm from
#foreach ($unique in $table.Unices) 
UNIQUE($unique.ColumnList), 
#end

to
#foreach ($unique in $table.Unices) 
UNIQUE $unique.Name ($unique.ColumnList), 
#end

I think we have to change unique.vm to do the following semantics:
if ("unique name" is specified) {
 unique $uniq.name ('column')
}
else {
unique ('column')
}

We could also set the name whenever creating an sql unique column For example, if you have to maintain two different databases (i.e. oracle and mysql), both generated from the same xml file, you have probably written a tool which compares both databases. Oracle always uses an unique index name (afaik), mysql can do without, but comparisson from your tool failes.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Updated: (TORQUE-110) unique name not parsed when generating mysql (sql/base/mysql/unique.vm)

Posted by "Peter Frühberger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/TORQUE-110?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Peter Frühberger updated TORQUE-110:
------------------------------------

    Component/s:     (was: Maven 1 Plugin)
                 Generator

> unique name not parsed when generating mysql (sql/base/mysql/unique.vm)
> -----------------------------------------------------------------------
>
>                 Key: TORQUE-110
>                 URL: https://issues.apache.org/jira/browse/TORQUE-110
>             Project: Torque
>          Issue Type: Bug
>          Components: Generator
>    Affects Versions: 3.3-RC3
>         Environment: debian etch linux
>            Reporter: Peter Frühberger
>            Priority: Minor
>
> The following snippet of code:
> <unique name="NAME_IDX">
> <unique-column name="NAME"/>    
> </unique>
> Schema:
> <!ELEMENT index (option*,index-column+)>
> <!ATTLIST index
>   name CDATA #IMPLIED
> generates the following mysql code (the name is totally ignored), but the schema allows it.
> Create ...
>         ...
>     UNIQUE (NAME)
> );
> The unique index name (NAME_IDX) is missing, it should correctly be:
> Create ...
>         UNIQUE NAME_IDX (NAME);
> );
> changing the unique.vm in sql/base/mysql/unique.vm from
> #foreach ($unique in $table.Unices) 
> UNIQUE($unique.ColumnList), 
> #end
> to
> #foreach ($unique in $table.Unices) 
> UNIQUE $unique.Name ($unique.ColumnList), 
> #end
> I think we have to change unique.vm to do the following semantics:
> if ("unique name" is specified) {
>  unique $uniq.name ('column')
> }
> else {
> unique ('column')
> }
> We could also set the name whenever creating an sql unique column For example, if you have to maintain two different databases (i.e. oracle and mysql), both generated from the same xml file, you have probably written a tool which compares both databases. Oracle always uses an unique index name (afaik), mysql can do without, but comparisson from your tool failes.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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