db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thoralf Rickert (JIRA)" <j...@apache.org>
Subject [jira] Commented: (TORQUE-27) Need ability to pass global user-configurable platform-specific hints to templates
Date Wed, 12 Jul 2006 10:00:30 GMT
    [ http://issues.apache.org/jira/browse/TORQUE-27?page=comments#action_12420575 ] 

Thoralf Rickert commented on TORQUE-27:
---------------------------------------

The proposal to create application specific custom templates isn't flexible. If you upgrade
torque, you've to upgrade and change your templates again. When you don't do this once a year
- you've forgotten, what you did with the templates. If you use a script to change the generated
code, you've to change this script too. I think one of the main goals of torque should be
to have static templates that the "user" doesn't have to change.

The table type hint in this bug relates to the used storage engine in the database tables.
I think mysql isn't the only database that supports more than one storage engine (this will
be a key feature of future databases). So this should be an optional table specific property
with a default value for the database. Of course, I'm using INNODB too and I'm using application
specific templates because of that.

On the other hand it would be useful to have such hints to add database, table or column specific
hints or features to the database schema (for example charset encoding, mime-types, auto-increment
start values, unsigned values and so on). I think this could be in the "template properties"
in the torque properties but this seems to be unusual - especially if you have to set column
hints. It looks for me as a quick hack.

I think it would be better to add a new attribute to the xml tags "database", "table" and
"column" (maybe other too). The value of this attribute can be added to the generated sql
output (just a plain pass thru without parsing).

> Need ability to pass global user-configurable platform-specific hints to templates
> ----------------------------------------------------------------------------------
>
>          Key: TORQUE-27
>          URL: http://issues.apache.org/jira/browse/TORQUE-27
>      Project: Torque
>         Type: Improvement

>   Components: Generator
>     Versions: 3.2
>  Environment: Fedora Core 5 Linux, Sun JDK1.4.2_08.
>     Reporter: Adrian Price
>     Priority: Minor

>
> It would be useful to provide a generic mechanism to enable the user to pass global platform-specific
hints to templates. For example, for MySQL it is desirable to explicitly specify the type
of table to be created, e.g., CREATE TABLE foo (...) Type = InnoDB. Such global hints could
then be specified by the user through platform specific properties or property files, as in:

> platform.properties:
> mysql.table.hint=Type = InnoDB. 
> A matching table.vm template might look something like:
> # -----------------------------------------------------------------------
> # $table.Name
> # -----------------------------------------------------------------------
> $generator.parse("$basepath/drop.vm", "", "table", $tbl)
> CREATE TABLE $table.Name
> (
> etc...
> ) $platform.getProperty('mysql.table.hint');
> Without such a capability it is necessary to hard-code the required customizations into
the templates, which is a rather inflexible and inconvenient way of doing it.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
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