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 "CG Monroe (JIRA)" <ji...@apache.org> on 2006/06/13 16:55:30 UTC

[jira] Commented: (TORQUE-27) Need ability to pass global user-configurable platform-specific hints to templates

    [ http://issues.apache.org/jira/browse/TORQUE-27?page=comments#action_12416023 ] 

CG Monroe commented on TORQUE-27:
---------------------------------

The main issues I can see with this are: 

It's a DB specific enhancement and IMHO Torque is designed to encourage (but not enforce) cross DB code creation.  

Should this be in Torque or done as an application specific post Torque SQL generation task?  E.g., use Torque to generate "standard" SQL then run a script to modify it as needed.  I think there are some ant edit  tasks that could be used to do this.

Also,  how many DB specific SQL script "tweaks" are out there?  If we start supporting them, how do we document the various DB specific options?

That said, there is an easy way to impliment this (or modify the templates used for your application).

All torque.* build.properties are automatically translated into template properties using the format:

torque.major.minor.sub -> $majorMinorSub

This means you could just add your own custom tags to the build properties like:

torque.mysql.table.hint=Type=InnoDB

Then modify the tempate to look like:

CREATE TABLE $table.Name
(
etc...
)  ${mysqlTableHint};

No code changes, just an application specific custom template.




> 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