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 tf...@apache.org on 2013/05/03 23:26:06 UTC
svn commit: r1478984 [1/3] - in
/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql:
conf/ outlets/ templates/ddl/ templates/ddl/derby/ templates/ddl/hsqldb/
templates/ddl/mssql/ templates/ddl/mysql/ templates/d...
Author: tfischer
Date: Fri May 3 21:25:27 2013
New Revision: 1478984
URL: http://svn.apache.org/r1478984
Log:
TORQUE-272, TORQUE-273 use groovy templates for sql generation
Added:
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/column.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/createDatabaseSchema.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/database.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/columnComment.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/databaseStart.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/dropForeignKey.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/dropTable.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/dropView.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/foreignKey.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/index.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/primaryKey.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/table.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/tableComment.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/tableCreateOptions.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/unique.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/view.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/dropDatabaseSchema.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/dropSkipDecider.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/hsqldb/columnComment.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/hsqldb/databaseStart.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/hsqldb/dropForeignKey.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/hsqldb/dropTable.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/hsqldb/dropView.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/hsqldb/foreignKey.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/hsqldb/index.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/hsqldb/primaryKey.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/hsqldb/table.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/hsqldb/tableComment.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/hsqldb/tableCreateOptions.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/hsqldb/unique.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/hsqldb/view.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mssql/columnComment.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mssql/databaseStart.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mssql/dropForeignKey.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mssql/dropTable.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mssql/dropView.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mssql/foreignKey.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mssql/index.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mssql/primaryKey.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mssql/sequence.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mssql/table.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mssql/tableComment.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mssql/tableCreateOptions.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mssql/unique.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mssql/view.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mysql/columnComment.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mysql/databaseStart.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mysql/dropForeignKey.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mysql/dropTable.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mysql/dropView.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mysql/foreignKey.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mysql/index.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mysql/primaryKey.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mysql/sequence.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mysql/table.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mysql/tableComment.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mysql/tableCreateOptions.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mysql/unique.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mysql/view.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/oracle/columnComment.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/oracle/databaseStart.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/oracle/dropForeignKey.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/oracle/dropTable.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/oracle/dropView.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/oracle/foreignKey.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/oracle/index.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/oracle/primaryKey.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/oracle/sequence.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/oracle/table.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/oracle/tableComment.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/oracle/tableCreateOptions.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/oracle/unique.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/oracle/view.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/postgresql/columnComment.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/postgresql/databaseStart.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/postgresql/dropForeignKey.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/postgresql/dropTable.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/postgresql/dropView.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/postgresql/foreignKey.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/postgresql/index.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/postgresql/primaryKey.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/postgresql/sequence.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/postgresql/table.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/postgresql/tableComment.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/postgresql/tableCreateOptions.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/postgresql/unique.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/postgresql/view.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/tableSkipDecider.groovy
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/viewColumn.groovy
Modified:
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/conf/control.xml
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/outlets/ddl.xml
Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/conf/control.xml
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/conf/control.xml?rev=1478984&r1=1478983&r2=1478984&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/conf/control.xml (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/conf/control.xml Fri May 3 21:25:27 2013
@@ -18,7 +18,7 @@
under the License.
-->
-<control loglevel="info"
+<control loglevel="trace"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://db.apache.org/torque/4.0/generator/configuration
http://db.apache.org/torque/4.0/generator/configuration.xsd"
@@ -33,23 +33,19 @@
systemId="http://db.apache.org/torque/4.0/templates/database-strict.xsd"
resource="../../xsd/database-4-0-strict.xsd" />
- <output name="torque.sql.ddl">
+ <output name="torque.sql.ddl" >
<filenameOutlet
xsi:type="javaOutlet"
class="org.apache.torque.generator.outlet.java.ModifySourcenameOutlet">
<discardFrom>.</discardFrom>
<suffix>.sql</suffix>
</filenameOutlet>
- <!-- source xsi:type="fileSource">
+ <source xsi:type="fileSource">
<transformer class="org.apache.torque.generator.source.transform.SourceElementToModelTransformer">
<modelRootClass>org.apache.torque.templates.model.Database</modelRootClass>
</transformer>
<transformer class="org.apache.torque.templates.transformer.sql.SQLModelTransformer"/>
<include>*schema.xml</include>
- </source-->
- <source xsi:type="fileSource" elements="database">
- <transformer class="org.apache.torque.templates.transformer.sql.SQLTransformer"/>
- <include>*schema.xml</include>
</source>
<outlet name="torque.sql.ddl.database"/>
</output>
Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/outlets/ddl.xml
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/outlets/ddl.xml?rev=1478984&r1=1478983&r2=1478984&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/outlets/ddl.xml (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/outlets/ddl.xml Fri May 3 21:25:27 2013
@@ -22,8 +22,8 @@
xsi:schemaLocation="http://db.apache.org/torque/4.0/generator/configuration http://db.apache.org/torque/4.0/generator/configuration.xsd"
xmlns="http://db.apache.org/torque/4.0/generator/configuration">
<outlet name="torque.sql.ddl.database"
- xsi:type="velocityOutlet"
- path="ddl/database.vm">
+ xsi:type="groovyOutlet"
+ path="ddl/database.groovy">
<mergepoint name="databaseStart">
<action xsi:type="applyAction"
outlet="torque.sql.ddl.databaseStart"/>
@@ -34,64 +34,64 @@
</mergepoint>
<mergepoint name="createSchema">
<action xsi:type="traverseAllAction"
- element="databaseSchema"
+ element="schemaNameList"
outlet="torque.sql.ddl.createDatabaseSchema"/>
</mergepoint>
<mergepoint name="tables">
<action xsi:type="traverseAllAction"
- element="all-tables/table"
+ element="allTables"
outlet="torque.sql.ddl.tableSkipDecider"/>
</mergepoint>
<mergepoint name="foreignKeys">
<action xsi:type="traverseAllAction"
- element="all-tables/table"
+ element="allTables"
outlet="torque.sql.ddl.foreignKeySkipDecider"/>
</mergepoint>
<mergepoint name="views">
<action xsi:type="traverseAllAction"
- element="all-views/view"
+ element="allViews"
outlet="torque.sql.ddl.view"/>
</mergepoint>
<mergepoint name="comments">
<action xsi:type="traverseAllAction"
- element="all-tables/table"
+ element="allTables"
outlet="torque.sql.ddl.commentSkipDecider"/>
</mergepoint>
<mergepoint name="databaseEnd" />
</outlet>
<outlet name="torque.sql.ddl.dropSkipDecider"
- xsi:type="velocityOutlet"
- path="ddl/dropSkipDecider.vm">
+ xsi:type="groovyOutlet"
+ path="ddl/dropSkipDecider.groovy">
<mergepoint name="drop">
<action xsi:type="traverseAllAction"
- element="all-views/view"
+ element="allViews"
outlet="torque.sql.ddl.dropView"/>
<action xsi:type="traverseAllAction"
- element="all-tables/table"
+ element="allTables"
outlet="torque.sql.ddl.dropForeignKeySkipDecider"/>
<action xsi:type="traverseAllAction"
- element="all-tables/table"
+ element="allTables"
outlet="torque.sql.ddl.dropTableSkipDecider"/>
<action xsi:type="traverseAllAction"
- element="databaseSchema"
+ element="schemaNameList"
outlet="torque.sql.ddl.dropDatabaseSchema"/>
</mergepoint>
</outlet>
<outlet name="torque.sql.ddl.dropForeignKeySkipDecider"
- xsi:type="velocityOutlet"
- path="ddl/tableSkipDecider.vm">
+ xsi:type="groovyOutlet"
+ path="ddl/tableSkipDecider.groovy">
<mergepoint name="table">
<action xsi:type="traverseAllAction"
- element="foreign-key"
+ element="foreignKeyList"
outlet="torque.sql.ddl.dropForeignKey"/>
</mergepoint>
</outlet>
<outlet name="torque.sql.ddl.dropTableSkipDecider"
- xsi:type="velocityOutlet"
- path="ddl/tableSkipDecider.vm">
+ xsi:type="groovyOutlet"
+ path="ddl/tableSkipDecider.groovy">
<mergepoint name="table">
<action xsi:type="applyAction"
outlet="torque.sql.ddl.dropTable"/>
@@ -99,8 +99,8 @@
</outlet>
<outlet name="torque.sql.ddl.tableSkipDecider"
- xsi:type="velocityOutlet"
- path="ddl/tableSkipDecider.vm">
+ xsi:type="groovyOutlet"
+ path="ddl/tableSkipDecider.groovy">
<mergepoint name="table">
<action xsi:type="applyAction"
outlet="torque.sql.ddl.table"/>
@@ -108,18 +108,18 @@
</outlet>
<outlet name="torque.sql.ddl.foreignKeySkipDecider"
- xsi:type="velocityOutlet"
- path="ddl/tableSkipDecider.vm">
+ xsi:type="groovyOutlet"
+ path="ddl/tableSkipDecider.groovy">
<mergepoint name="table">
<action xsi:type="traverseAllAction"
- element="foreign-key"
+ element="foreignKeyList"
outlet="torque.sql.ddl.foreignKey"/>
</mergepoint>
</outlet>
<outlet name="torque.sql.ddl.commentSkipDecider"
- xsi:type="velocityOutlet"
- path="ddl/tableSkipDecider.vm">
+ xsi:type="groovyOutlet"
+ path="ddl/tableSkipDecider.groovy">
<mergepoint name="table">
<action xsi:type="applyAction"
outlet="torque.sql.ddl.tableComment"/>
@@ -130,25 +130,25 @@
</outlet>
<outlet name="torque.sql.ddl.databaseStart"
- xsi:type="velocityOutlet"
- path="ddl/${option:database}/databaseStart.vm"/>
+ xsi:type="groovyOutlet"
+ path="ddl/${option:database}/databaseStart.groovy"/>
<outlet name="torque.sql.ddl.createDatabaseSchema"
- xsi:type="velocityOutlet"
- path="ddl/createDatabaseSchema.vm">
+ xsi:type="groovyOutlet"
+ path="ddl/createDatabaseSchema.groovy">
</outlet>
<outlet name="torque.sql.ddl.dropDatabaseSchema"
- xsi:type="velocityOutlet"
- path="ddl/dropDatabaseSchema.vm">
+ xsi:type="groovyOutlet"
+ path="ddl/dropDatabaseSchema.groovy">
</outlet>
<outlet name="torque.sql.ddl.table"
- xsi:type="velocityOutlet"
- path="ddl/${option:database}/table.vm">
+ xsi:type="groovyOutlet"
+ path="ddl/${option:database}/table.groovy">
<mergepoint name="columns">
<action xsi:type="traverseAllAction"
- element="column"
+ element="columnList"
outlet="torque.sql.ddl.column"/>
</mergepoint>
<mergepoint name="primaryKey">
@@ -157,12 +157,12 @@
</mergepoint>
<mergepoint name="unique">
<action xsi:type="traverseAllAction"
- element="unique"
+ element="uniqueList"
outlet="torque.sql.ddl.unique"/>
</mergepoint>
<mergepoint name="index">
<action xsi:type="traverseAllAction"
- element="index"
+ element="indexList"
outlet="torque.sql.ddl.index"/>
</mergepoint>
<mergepoint name="sequence">
@@ -176,36 +176,36 @@
</outlet>
<outlet name="torque.sql.ddl.dropTable"
- xsi:type="velocityOutlet"
- path="ddl/${option:database}/dropTable.vm" />
+ xsi:type="groovyOutlet"
+ path="ddl/${option:database}/dropTable.groovy" />
<outlet name="torque.sql.ddl.dropForeignKey"
- xsi:type="velocityOutlet"
- path="ddl/${option:database}/dropForeignKey.vm" />
+ xsi:type="groovyOutlet"
+ path="ddl/${option:database}/dropForeignKey.groovy" />
<outlet name="torque.sql.ddl.column"
- xsi:type="velocityOutlet"
- path="ddl/column.vm" />
+ xsi:type="groovyOutlet"
+ path="ddl/column.groovy" />
<outlet name="torque.sql.ddl.primaryKey"
- xsi:type="velocityOutlet"
- path="ddl/${option:database}/primaryKey.vm" />
+ xsi:type="groovyOutlet"
+ path="ddl/${option:database}/primaryKey.groovy" />
<outlet name="torque.sql.ddl.unique"
- xsi:type="velocityOutlet"
- path="ddl/${option:database}/unique.vm" />
+ xsi:type="groovyOutlet"
+ path="ddl/${option:database}/unique.groovy" />
<outlet name="torque.sql.ddl.index"
- xsi:type="velocityOutlet"
- path="ddl/${option:database}/index.vm" />
+ xsi:type="groovyOutlet"
+ path="ddl/${option:database}/index.groovy" />
<outlet name="torque.sql.ddl.sequence"
- xsi:type="velocityOutlet"
- path="ddl/${option:database}/sequence.vm" />
+ xsi:type="groovyOutlet"
+ path="ddl/${option:database}/sequence.groovy" />
<outlet name="torque.sql.ddl.tableComment"
- xsi:type="velocityOutlet"
- path="ddl/${option:database}/tableComment.vm">
+ xsi:type="groovyOutlet"
+ path="ddl/${option:database}/tableComment.groovy">
<mergepoint name="columnComments">
<action xsi:type="traverseAllAction"
element="column"
@@ -214,35 +214,35 @@
</outlet>
<outlet name="torque.sql.ddl.tableCreateOptions"
- xsi:type="velocityOutlet"
- path="ddl/${option:database}/tableCreateOptions.vm">
+ xsi:type="groovyOutlet"
+ path="ddl/${option:database}/tableCreateOptions.groovy">
</outlet>
<outlet name="torque.sql.ddl.columnComment"
- xsi:type="velocityOutlet"
- path="ddl/${option:database}/columnComment.vm" />
+ xsi:type="groovyOutlet"
+ path="ddl/${option:database}/columnComment.groovy" />
<outlet name="torque.sql.ddl.foreignKey"
- xsi:type="velocityOutlet"
- path="ddl/${option:database}/foreignKey.vm" />
+ xsi:type="groovyOutlet"
+ path="ddl/${option:database}/foreignKey.groovy" />
<outlet name="torque.sql.ddl.view"
- xsi:type="velocityOutlet"
- path="ddl/${option:database}/view.vm">
+ xsi:type="groovyOutlet"
+ path="ddl/${option:database}/view.groovy">
<mergepoint name="columns">
<action xsi:type="traverseAllAction"
- element="column"
+ element="columnList"
outlet="torque.sql.ddl.viewColumn"/>
</mergepoint>
</outlet>
<outlet name="torque.sql.ddl.dropView"
- xsi:type="velocityOutlet"
- path="ddl/${option:database}/dropView.vm">
+ xsi:type="groovyOutlet"
+ path="ddl/${option:database}/dropView.groovy">
</outlet>
<outlet name="torque.sql.ddl.viewColumn"
- xsi:type="velocityOutlet"
- path="ddl/viewColumn.vm">
+ xsi:type="groovyOutlet"
+ path="ddl/viewColumn.groovy">
</outlet>
</outlets>
\ No newline at end of file
Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/column.groovy
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/column.groovy?rev=1478984&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/column.groovy (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/column.groovy Fri May 3 21:25:27 2013
@@ -0,0 +1,23 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+import org.apache.torque.generator.template.groovy.TorqueGenGroovy
+import org.apache.torque.templates.model.Column
+
+TorqueGenGroovy torqueGenGroovy = (TorqueGenGroovy) torqueGen
+Column column = torqueGenGroovy.model
+return """ ${column.name} ${column.ddlSql},
+"""
Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/createDatabaseSchema.groovy
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/createDatabaseSchema.groovy?rev=1478984&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/createDatabaseSchema.groovy (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/createDatabaseSchema.groovy Fri May 3 21:25:27 2013
@@ -0,0 +1,24 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+import org.apache.torque.generator.template.groovy.TorqueGenGroovy
+import org.apache.torque.templates.model.Database
+
+TorqueGenGroovy torqueGenGroovy = (TorqueGenGroovy) torqueGen
+String schemaName = torqueGenGroovy.model
+return """
+CREATE SCHEMA ${schemaName};
+"""
\ No newline at end of file
Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/database.groovy
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/database.groovy?rev=1478984&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/database.groovy (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/database.groovy Fri May 3 21:25:27 2013
@@ -0,0 +1,27 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+import org.apache.torque.generator.template.groovy.TorqueGenGroovy
+
+TorqueGenGroovy torqueGenGroovy = (TorqueGenGroovy) torqueGen
+return torqueGenGroovy.mergepoint("databaseStart") +
+ torqueGenGroovy.mergepoint("drop") +
+ torqueGenGroovy.mergepoint("createSchema") +
+ torqueGenGroovy.mergepoint("tables") +
+ torqueGenGroovy.mergepoint("foreignKeys") +
+ torqueGenGroovy.mergepoint("views") +
+ torqueGenGroovy.mergepoint("comments") +
+ torqueGenGroovy.mergepoint("databaseEnd") + "\n"
\ No newline at end of file
Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/columnComment.groovy
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/columnComment.groovy?rev=1478984&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/columnComment.groovy (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/columnComment.groovy Fri May 3 21:25:27 2013
@@ -0,0 +1,18 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+// no Comments on columns in derby
Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/databaseStart.groovy
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/databaseStart.groovy?rev=1478984&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/databaseStart.groovy (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/databaseStart.groovy Fri May 3 21:25:27 2013
@@ -0,0 +1,28 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+import org.apache.torque.generator.template.groovy.TorqueGenGroovy
+import org.apache.torque.templates.model.Database
+
+TorqueGenGroovy torqueGenGroovy = (TorqueGenGroovy) torqueGen
+Database database = torqueGenGroovy.model
+return """\
+-- -----------------------------------------------------------------------
+-- ${torqueGenGroovy.getOption("torque.database")} SQL script for schema $database.name
+-- -----------------------------------------------------------------------
+
+
+"""
\ No newline at end of file
Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/dropForeignKey.groovy
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/dropForeignKey.groovy?rev=1478984&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/dropForeignKey.groovy (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/dropForeignKey.groovy Fri May 3 21:25:27 2013
@@ -0,0 +1,28 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+import org.apache.torque.generator.template.groovy.TorqueGenGroovy
+import org.apache.torque.templates.model.ForeignKey
+
+TorqueGenGroovy torqueGenGroovy = (TorqueGenGroovy) torqueGen
+ForeignKey foreignKey = torqueGenGroovy.model
+
+return """\
+ALTER TABLE $foreignKey.parent.name
+ DROP CONSTRAINT $foreignKey.name;
+
+
+"""
Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/dropTable.groovy
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/dropTable.groovy?rev=1478984&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/dropTable.groovy (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/dropTable.groovy Fri May 3 21:25:27 2013
@@ -0,0 +1,25 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+import org.apache.torque.generator.template.groovy.TorqueGenGroovy
+import org.apache.torque.templates.model.Table
+
+TorqueGenGroovy torqueGenGroovy = (TorqueGenGroovy) torqueGen
+Table table = torqueGenGroovy.model
+
+return """\
+drop table $table.name;
+"""
\ No newline at end of file
Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/dropView.groovy
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/dropView.groovy?rev=1478984&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/dropView.groovy (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/dropView.groovy Fri May 3 21:25:27 2013
@@ -0,0 +1,28 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+import org.apache.torque.generator.template.groovy.TorqueGenGroovy
+import org.apache.torque.templates.model.View
+
+TorqueGenGroovy torqueGenGroovy = (TorqueGenGroovy) torqueGen
+View view = torqueGenGroovy.model
+if (!view.skipSql.equals("true"))
+{
+ return """\
+DROP VIEW ${view.name};
+
+"""
+}
\ No newline at end of file
Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/foreignKey.groovy
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/foreignKey.groovy?rev=1478984&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/foreignKey.groovy (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/foreignKey.groovy Fri May 3 21:25:27 2013
@@ -0,0 +1,53 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+import org.apache.torque.generator.template.groovy.TorqueGenGroovy
+import org.apache.torque.templates.model.ForeignKey
+
+TorqueGenGroovy torqueGenGroovy = (TorqueGenGroovy) torqueGen
+ForeignKey foreignKey = torqueGenGroovy.model
+
+def result = """\
+ALTER TABLE $foreignKey.parent.name
+ ADD CONSTRAINT $foreignKey.name
+ FOREIGN KEY ($foreignKey.localColumnNames)
+ REFERENCES $foreignKey.foreignTable ($foreignKey.foreignColumnNames)"""
+if (foreignKey.onUpdate == "setnull")
+{
+ result += """
+ ON UPDATE SET NULL"""
+}
+else if (foreignKey.onUpdate)
+{
+ result += """
+ ON UPDATE ${foreignKey.onUpdate.toUpperCase()}"""
+}
+if (foreignKey.onDelete == "setnull")
+{
+ result += """
+
+ ON DELETE SET NULL"""
+}
+else if (foreignKey.onDelete)
+{
+ result += """
+
+ ON DELETE ${foreignKey.onDelete.toUpperCase()}"""
+}
+result += """;
+
+"""
+return result
\ No newline at end of file
Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/index.groovy
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/index.groovy?rev=1478984&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/index.groovy (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/index.groovy Fri May 3 21:25:27 2013
@@ -0,0 +1,38 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+import org.apache.torque.generator.template.groovy.TorqueGenGroovy
+import org.apache.torque.templates.model.Index
+import org.apache.commons.lang.StringUtils
+
+TorqueGenGroovy torqueGenGroovy = (TorqueGenGroovy) torqueGen
+Index index = torqueGenGroovy.model
+String indexName = index.name
+if (index.indexColumnNames != "")
+{
+ if (StringUtils.isBlank(indexName))
+ {
+ indexName = ""
+ }
+ else
+ {
+ indexName = " " + indexName
+ }
+ return """\
+CREATE INDEX${indexName} ON ${index.parent.name} ($index.indexColumnNames);
+"""
+}
+
Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/primaryKey.groovy
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/primaryKey.groovy?rev=1478984&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/primaryKey.groovy (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/primaryKey.groovy Fri May 3 21:25:27 2013
@@ -0,0 +1,28 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+import org.apache.torque.generator.template.groovy.TorqueGenGroovy
+import org.apache.torque.templates.model.Table
+
+TorqueGenGroovy torqueGenGroovy = (TorqueGenGroovy) torqueGen
+Table table = torqueGenGroovy.model
+if (table.primaryKeyColumnNames != "")
+{
+ return """\
+ PRIMARY KEY($table.primaryKeyColumnNames),
+"""
+}
+
Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/table.groovy
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/table.groovy?rev=1478984&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/table.groovy (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/table.groovy Fri May 3 21:25:27 2013
@@ -0,0 +1,42 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+import org.apache.torque.generator.template.groovy.TorqueGenGroovy
+import org.apache.torque.templates.model.Table
+
+TorqueGenGroovy torqueGenGroovy = (TorqueGenGroovy) torqueGen
+Table table = torqueGenGroovy.model
+String cols = torqueGenGroovy.mergepoint("columns")
+String pk = torqueGenGroovy.mergepoint("primaryKey")
+String unique = torqueGenGroovy.mergepoint("unique")
+String createTableSql = "${cols}${pk}${unique}"
+int lastCommaPos = createTableSql.lastIndexOf(",")
+if (lastCommaPos != -1)
+{
+ createTableSql = createTableSql.substring(0, lastCommaPos)
+}
+
+def result = """
+-- -----------------------------------------------------------------------
+-- $table.name
+-- -----------------------------------------------------------------------
+CREATE TABLE $table.name
+(
+${createTableSql}
+);
+
+${torqueGenGroovy.mergepoint("index")}"""
+
Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/tableComment.groovy
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/tableComment.groovy?rev=1478984&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/tableComment.groovy (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/tableComment.groovy Fri May 3 21:25:27 2013
@@ -0,0 +1,18 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+// no Comments on tables in derby
Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/tableCreateOptions.groovy
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/tableCreateOptions.groovy?rev=1478984&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/tableCreateOptions.groovy (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/tableCreateOptions.groovy Fri May 3 21:25:27 2013
@@ -0,0 +1,23 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+//////////
+//
+// version $Id: tableCreateOptions.vm 1437184 2013-01-22 21:25:57Z tfischer $
+//
+// No table create options are implemented.
+//
Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/unique.groovy
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/unique.groovy?rev=1478984&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/unique.groovy (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/unique.groovy Fri May 3 21:25:27 2013
@@ -0,0 +1,26 @@
+package org.apache.torque.templates.sql.templates.ddl.derby
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+import org.apache.torque.generator.template.groovy.TorqueGenGroovy
+import org.apache.torque.templates.model.Unique
+
+TorqueGenGroovy torqueGenGroovy = (TorqueGenGroovy) torqueGen
+Unique unique = torqueGenGroovy.model
+if (unique.uniqueColumnNames != "")
+{
+ return " CONSTRAINT ${unique.name} UNIQUE($unique.uniqueColumnNames),"
+}
Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/view.groovy
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/view.groovy?rev=1478984&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/view.groovy (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/view.groovy Fri May 3 21:25:27 2013
@@ -0,0 +1,47 @@
+package org.apache.torque.templates.sql.templates.ddl.derby
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+import org.apache.torque.generator.template.groovy.TorqueGenGroovy
+import org.apache.torque.templates.model.View
+
+TorqueGenGroovy torqueGenGroovy = (TorqueGenGroovy) torqueGen
+View view = torqueGenGroovy.model
+if (!view.skipSql.equals("true"))
+{
+ if (view.createSql != null)
+ {
+ return view.createSql + """
+
+"""
+ }
+ else
+ {
+ String cols = torqueGenGroovy.mergepoint("columns")
+ int lastCommaPos = cols.lastIndexOf(",")
+ if (lastCommaPos != -1)
+ {
+ cols = cols.substring(0, lastCommaPos)
+ }
+
+ return """CREATE VIEW ${view.name} AS
+ SELECT
+${cols}
+ ${view.sqlSuffix};
+
+"""
+ }
+}
Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/dropDatabaseSchema.groovy
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/dropDatabaseSchema.groovy?rev=1478984&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/dropDatabaseSchema.groovy (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/dropDatabaseSchema.groovy Fri May 3 21:25:27 2013
@@ -0,0 +1,24 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+import org.apache.torque.generator.template.groovy.TorqueGenGroovy
+import org.apache.torque.templates.model.Database
+
+TorqueGenGroovy torqueGenGroovy = (TorqueGenGroovy) torqueGen
+String schemaName = torqueGenGroovy.model
+return """
+DROP SCHEMA ${schemaName};
+"""
\ No newline at end of file
Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/dropSkipDecider.groovy
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/dropSkipDecider.groovy?rev=1478984&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/dropSkipDecider.groovy (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/dropSkipDecider.groovy Fri May 3 21:25:27 2013
@@ -0,0 +1,27 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+import org.apache.torque.generator.template.groovy.TorqueGenGroovy
+
+TorqueGenGroovy torqueGenGroovy = (TorqueGenGroovy) torqueGen
+if (torqueGenGroovy.booleanOption("torque.sql.generate.drops"))
+{
+ return torqueGenGroovy.mergepoint("drop")
+}
+else
+{
+ return ""
+}
\ No newline at end of file
Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/hsqldb/columnComment.groovy
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/hsqldb/columnComment.groovy?rev=1478984&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/hsqldb/columnComment.groovy (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/hsqldb/columnComment.groovy Fri May 3 21:25:27 2013
@@ -0,0 +1,18 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+// no Comments on columns in hsqldb
Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/hsqldb/databaseStart.groovy
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/hsqldb/databaseStart.groovy?rev=1478984&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/hsqldb/databaseStart.groovy (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/hsqldb/databaseStart.groovy Fri May 3 21:25:27 2013
@@ -0,0 +1,28 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+import org.apache.torque.generator.template.groovy.TorqueGenGroovy
+import org.apache.torque.templates.model.Database
+
+TorqueGenGroovy torqueGenGroovy = (TorqueGenGroovy) torqueGen
+Database database = torqueGenGroovy.model
+return """\
+-- -----------------------------------------------------------------------
+-- ${torqueGenGroovy.getOption("torque.database")} SQL script for schema $database.name
+-- -----------------------------------------------------------------------
+
+
+"""
\ No newline at end of file
Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/hsqldb/dropForeignKey.groovy
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/hsqldb/dropForeignKey.groovy?rev=1478984&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/hsqldb/dropForeignKey.groovy (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/hsqldb/dropForeignKey.groovy Fri May 3 21:25:27 2013
@@ -0,0 +1,28 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+import org.apache.torque.generator.template.groovy.TorqueGenGroovy
+import org.apache.torque.templates.model.ForeignKey
+
+TorqueGenGroovy torqueGenGroovy = (TorqueGenGroovy) torqueGen
+ForeignKey foreignKey = torqueGenGroovy.model
+
+return """\
+ALTER TABLE $foreignKey.parent.name
+ DROP CONSTRAINT $foreignKey.name;
+
+
+"""
Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/hsqldb/dropTable.groovy
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/hsqldb/dropTable.groovy?rev=1478984&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/hsqldb/dropTable.groovy (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/hsqldb/dropTable.groovy Fri May 3 21:25:27 2013
@@ -0,0 +1,25 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+import org.apache.torque.generator.template.groovy.TorqueGenGroovy
+import org.apache.torque.templates.model.Table
+
+TorqueGenGroovy torqueGenGroovy = (TorqueGenGroovy) torqueGen
+Table table = torqueGenGroovy.model
+
+return """\
+drop table $table.name;
+"""
\ No newline at end of file
Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/hsqldb/dropView.groovy
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/hsqldb/dropView.groovy?rev=1478984&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/hsqldb/dropView.groovy (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/hsqldb/dropView.groovy Fri May 3 21:25:27 2013
@@ -0,0 +1,28 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+import org.apache.torque.generator.template.groovy.TorqueGenGroovy
+import org.apache.torque.templates.model.View
+
+TorqueGenGroovy torqueGenGroovy = (TorqueGenGroovy) torqueGen
+View view = torqueGenGroovy.model
+if (!view.skipSql.equals("true"))
+{
+ return """\
+DROP VIEW ${view.name} IF EXISTS;
+
+"""
+}
\ No newline at end of file
Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/hsqldb/foreignKey.groovy
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/hsqldb/foreignKey.groovy?rev=1478984&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/hsqldb/foreignKey.groovy (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/hsqldb/foreignKey.groovy Fri May 3 21:25:27 2013
@@ -0,0 +1,53 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+import org.apache.torque.generator.template.groovy.TorqueGenGroovy
+import org.apache.torque.templates.model.ForeignKey
+
+TorqueGenGroovy torqueGenGroovy = (TorqueGenGroovy) torqueGen
+ForeignKey foreignKey = torqueGenGroovy.model
+
+def result = """\
+ALTER TABLE $foreignKey.parent.name
+ ADD CONSTRAINT $foreignKey.name
+ FOREIGN KEY ($foreignKey.localColumnNames)
+ REFERENCES $foreignKey.foreignTable ($foreignKey.foreignColumnNames)"""
+if (foreignKey.onUpdate == "setnull")
+{
+ result += """
+ ON UPDATE SET NULL"""
+}
+else if (foreignKey.onUpdate)
+{
+ result += """
+ ON UPDATE ${foreignKey.onUpdate.toUpperCase()}"""
+}
+if (foreignKey.onDelete == "setnull")
+{
+ result += """
+
+ ON DELETE SET NULL"""
+}
+else if (foreignKey.onDelete)
+{
+ result += """
+
+ ON DELETE ${foreignKey.onDelete.toUpperCase()}"""
+}
+result += """;
+
+"""
+return result
\ No newline at end of file
Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/hsqldb/index.groovy
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/hsqldb/index.groovy?rev=1478984&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/hsqldb/index.groovy (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/hsqldb/index.groovy Fri May 3 21:25:27 2013
@@ -0,0 +1,38 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+import org.apache.torque.generator.template.groovy.TorqueGenGroovy
+import org.apache.torque.templates.model.Index
+import org.apache.commons.lang.StringUtils
+
+TorqueGenGroovy torqueGenGroovy = (TorqueGenGroovy) torqueGen
+Index index = torqueGenGroovy.model
+String indexName = index.name
+if (index.indexColumnNames != "")
+{
+ if (StringUtils.isBlank(indexName))
+ {
+ indexName = ""
+ }
+ else
+ {
+ indexName = " " + indexName
+ }
+ return """\
+CREATE INDEX${indexName} ON ${index.parent.name} ($index.indexColumnNames);
+"""
+}
+
Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/hsqldb/primaryKey.groovy
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/hsqldb/primaryKey.groovy?rev=1478984&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/hsqldb/primaryKey.groovy (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/hsqldb/primaryKey.groovy Fri May 3 21:25:27 2013
@@ -0,0 +1,28 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+import org.apache.torque.generator.template.groovy.TorqueGenGroovy
+import org.apache.torque.templates.model.Table
+
+TorqueGenGroovy torqueGenGroovy = (TorqueGenGroovy) torqueGen
+Table table = torqueGenGroovy.model
+if (table.primaryKeyColumnNames != "")
+{
+ return """\
+ PRIMARY KEY($table.primaryKeyColumnNames),
+"""
+}
+
Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/hsqldb/table.groovy
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/hsqldb/table.groovy?rev=1478984&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/hsqldb/table.groovy (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/hsqldb/table.groovy Fri May 3 21:25:27 2013
@@ -0,0 +1,42 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+import org.apache.torque.generator.template.groovy.TorqueGenGroovy
+import org.apache.torque.templates.model.Table
+
+TorqueGenGroovy torqueGenGroovy = (TorqueGenGroovy) torqueGen
+Table table = torqueGenGroovy.model
+String cols = torqueGenGroovy.mergepoint("columns")
+String pk = torqueGenGroovy.mergepoint("primaryKey")
+String unique = torqueGenGroovy.mergepoint("unique")
+String createTableSql = "${cols}${pk}${unique}"
+int lastCommaPos = createTableSql.lastIndexOf(",")
+if (lastCommaPos != -1)
+{
+ createTableSql = createTableSql.substring(0, lastCommaPos)
+}
+
+def result = """
+-- -----------------------------------------------------------------------
+-- $table.name
+-- -----------------------------------------------------------------------
+CREATE TABLE $table.name
+(
+${createTableSql}
+);
+
+${torqueGenGroovy.mergepoint("index")}"""
+
Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/hsqldb/tableComment.groovy
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/hsqldb/tableComment.groovy?rev=1478984&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/hsqldb/tableComment.groovy (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/hsqldb/tableComment.groovy Fri May 3 21:25:27 2013
@@ -0,0 +1,18 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+// no Comments on tables in hsqldb
Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/hsqldb/tableCreateOptions.groovy
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/hsqldb/tableCreateOptions.groovy?rev=1478984&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/hsqldb/tableCreateOptions.groovy (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/hsqldb/tableCreateOptions.groovy Fri May 3 21:25:27 2013
@@ -0,0 +1,23 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+//////////
+//
+// version $Id: tableCreateOptions.vm 1437184 2013-01-22 21:25:57Z tfischer $
+//
+// No table create options are implemented.
+//
Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/hsqldb/unique.groovy
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/hsqldb/unique.groovy?rev=1478984&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/hsqldb/unique.groovy (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/hsqldb/unique.groovy Fri May 3 21:25:27 2013
@@ -0,0 +1,25 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+import org.apache.torque.generator.template.groovy.TorqueGenGroovy
+import org.apache.torque.templates.model.Unique
+
+TorqueGenGroovy torqueGenGroovy = (TorqueGenGroovy) torqueGen
+Unique unique = torqueGenGroovy.model
+if (unique.uniqueColumnNames != "")
+{
+ return " CONSTRAINT ${unique.name} UNIQUE($unique.uniqueColumnNames),"
+}
Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/hsqldb/view.groovy
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/hsqldb/view.groovy?rev=1478984&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/hsqldb/view.groovy (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/hsqldb/view.groovy Fri May 3 21:25:27 2013
@@ -0,0 +1,46 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+import org.apache.torque.generator.template.groovy.TorqueGenGroovy
+import org.apache.torque.templates.model.View
+
+TorqueGenGroovy torqueGenGroovy = (TorqueGenGroovy) torqueGen
+View view = torqueGenGroovy.model
+if (!view.skipSql.equals("true"))
+{
+ if (view.createSql != null)
+ {
+ return view.createSql + """
+
+"""
+ }
+ else
+ {
+ String cols = torqueGenGroovy.mergepoint("columns")
+ int lastCommaPos = cols.lastIndexOf(",")
+ if (lastCommaPos != -1)
+ {
+ cols = cols.substring(0, lastCommaPos)
+ }
+
+ return """CREATE VIEW ${view.name} AS
+ SELECT
+${cols}
+ ${view.sqlSuffix};
+
+"""
+ }
+}
Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mssql/columnComment.groovy
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mssql/columnComment.groovy?rev=1478984&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mssql/columnComment.groovy (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mssql/columnComment.groovy Fri May 3 21:25:27 2013
@@ -0,0 +1,19 @@
+package org.apache.torque.templates.sql.templates.ddl.mssql
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+// no Comments on columns in mssql
Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mssql/databaseStart.groovy
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mssql/databaseStart.groovy?rev=1478984&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mssql/databaseStart.groovy (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mssql/databaseStart.groovy Fri May 3 21:25:27 2013
@@ -0,0 +1,29 @@
+package org.apache.torque.templates.sql.templates.ddl.mssql
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+import org.apache.torque.generator.template.groovy.TorqueGenGroovy
+import org.apache.torque.templates.model.Database
+
+TorqueGenGroovy torqueGenGroovy = (TorqueGenGroovy) torqueGen
+Database database = torqueGenGroovy.model
+return """\
+-- -----------------------------------------------------------------------
+-- ${torqueGenGroovy.getOption("torque.database")} SQL script for schema $database.name
+-- -----------------------------------------------------------------------
+
+
+"""
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org