db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tfisc...@apache.org
Subject svn commit: r919727 - in /db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates: idtable/conf/ idtable/templates/ sql/generatorDefs/ sql/templates/ddl/ sql/templates/ddl/mssql/ sql/templates/ddl/mysql/ sql/templates/dd...
Date Sat, 06 Mar 2010 09:48:57 GMT
Author: tfischer
Date: Sat Mar  6 09:48:56 2010
New Revision: 919727

URL: http://svn.apache.org/viewvc?rev=919727&view=rev
Log:
- changen filename of idtable-init.sql that these files do not overwrite each other
- fixed idtable id generation
- moved comments for database start into extra template, and altered comment syntax therein

Added:
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mssql/databaseStart.vm
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mysql/databaseStart.vm
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/oracle/databaseStart.vm
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/postgresql/databaseStart.vm
Modified:
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/idtable/conf/control.xml
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/idtable/templates/idtable.vm
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/generatorDefs/ddl.xml
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/database.vm

Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/idtable/conf/control.xml
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/idtable/conf/control.xml?rev=919727&r1=919726&r2=919727&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/idtable/conf/control.xml
(original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/idtable/conf/control.xml
Sat Mar  6 09:48:56 2010
@@ -23,7 +23,13 @@
     xsi:schemaLocation="http://db.apache.org/torque/gf/4.0/configuration http://db.apache.org/torque/gf/4.0/configuration.xsd"
     xmlns="http://db.apache.org/torque/gf/4.0/configuration">
   <options xsi:type="propertiesOptions" path="options.properties"/>
-  <output name="torque.sql.idtable.idtable" file="id-table-init.sql">
+  <output name="torque.sql.idtable.idtable">
+    <filenameGenerator
+        xsi:type="javaGenerator"
+        class="org.apache.torque.gf.generator.java.ModifySourcenameGenerator">
+      <discardFrom>.</discardFrom>
+      <suffix>-idtable-init.sql</suffix>
+    </filenameGenerator>
     <source elements="database">
       <include>*schema.xml</include>
       <exclude>id-table-schema.xml</exclude>

Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/idtable/templates/idtable.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/idtable/templates/idtable.vm?rev=919727&r1=919726&r2=919727&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/idtable/templates/idtable.vm
(original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/idtable/templates/idtable.vm
Sat Mar  6 09:48:56 2010
@@ -17,10 +17,17 @@
 ##
 ##
 #set ( $tableElements = $torqueGf.getChildren("table") )
-#set ( $initialIdValue = $torqueGf.option("torque.idBroker.initialIdValue") )
-#set ( $initialIdStep = $torqueGf.option("torque.idbroker.initialIdStep") )
-#set ( $initialId = $torqueGf.option("torque.idbroker.initialId") )
+#set ( $initialIdValue = $torqueGf.intOption("torque.idBroker.initialIdValue") )
+#set ( $initialIdStep = $torqueGf.intOption("torque.idbroker.initialIdStep") )
+#set ( $initialId = $torqueGf.getVariable("torque.idbroker.initialId") )
+#if ( !$initialId )
+  #set ( $initialId = $torqueGf.intOption("torque.idbroker.initialId") )
+#end
+#set ( $idValue = $initialId )
 #foreach ($tableElement in $tableElements)
   #set ( $tableName = $tableElement.getAttribute("name") )
-insert into ID_TABLE (id_table_id, table_name, next_id, quantity) VALUES ($initialId + $velocityCount
- 1, '$tableName', $initialIdValue, $initialIdStep);
+insert into ID_TABLE (id_table_id, table_name, next_id, quantity) VALUES ($idValue, '$tableName',
$initialIdValue, $initialIdStep);
+  #set ( $idValue = $idValue + 1)
 #end
+#set ( $dummy = $torqueGf.setVariable("torque.idbroker.initialId", $idValue, "GLOBAL" ) 
)
+

Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/generatorDefs/ddl.xml
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/generatorDefs/ddl.xml?rev=919727&r1=919726&r2=919727&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/generatorDefs/ddl.xml
(original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/generatorDefs/ddl.xml
Sat Mar  6 09:48:56 2010
@@ -25,6 +25,10 @@
   <generator name="torque.sql.ddl.database"
       xsi:type="velocityGenerator"
       path="ddl/database.vm">
+    <mergepoint name="databaseStart">
+      <action xsi:type="applyAction" 
+          generator="torque.sql.ddl.databaseStart"/>
+    </mergepoint>
     <mergepoint name="tables">
       <action xsi:type="traverseAllAction" 
           element="table" 
@@ -43,8 +47,13 @@
           element="table/column" 
           generator="torque.sql.ddl.columnComment"/>
     </mergepoint>
+    <mergepoint name="databaseEnd" />
   </generator>
 
+  <generator name="torque.sql.ddl.databaseStart"
+      xsi:type="velocityGenerator"
+      path="ddl/${option:database}/databaseStart.vm"/>
+
   <generator name="torque.sql.ddl.table"
       xsi:type="velocityGenerator"
       path="ddl/${option:database}/table.vm">

Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/database.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/database.vm?rev=919727&r1=919726&r2=919727&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/database.vm
(original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/database.vm
Sat Mar  6 09:48:56 2010
@@ -14,10 +14,6 @@
 ## KIND, either express or implied.  See the License for the
 ## specific language governing permissions and limitations
 ## under the License.
-# -----------------------------------------------------------------------
-# $torqueGf.option("torque.database") SQL script for schema $name
-# -----------------------------------------------------------------------
-
 $torqueGf.mergepoint("databaseStart")
 $torqueGf.mergepoint("tables")
 $torqueGf.mergepoint("foreignKeys")

Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mssql/databaseStart.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mssql/databaseStart.vm?rev=919727&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mssql/databaseStart.vm
(added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mssql/databaseStart.vm
Sat Mar  6 09:48:56 2010
@@ -0,0 +1,20 @@
+## 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.
+-- -----------------------------------------------------------------------
+-- $torqueGf.option("torque.database") SQL script for schema $name
+-- -----------------------------------------------------------------------
+

Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mysql/databaseStart.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mysql/databaseStart.vm?rev=919727&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mysql/databaseStart.vm
(added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mysql/databaseStart.vm
Sat Mar  6 09:48:56 2010
@@ -0,0 +1,20 @@
+## 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.
+-- -----------------------------------------------------------------------
+-- $torqueGf.option("torque.database") SQL script for schema $name
+-- -----------------------------------------------------------------------
+

Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/oracle/databaseStart.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/oracle/databaseStart.vm?rev=919727&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/oracle/databaseStart.vm
(added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/oracle/databaseStart.vm
Sat Mar  6 09:48:56 2010
@@ -0,0 +1,20 @@
+## 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.
+-- -----------------------------------------------------------------------
+-- $torqueGf.option("torque.database") SQL script for schema $name
+-- -----------------------------------------------------------------------
+

Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/postgresql/databaseStart.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/postgresql/databaseStart.vm?rev=919727&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/postgresql/databaseStart.vm
(added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/postgresql/databaseStart.vm
Sat Mar  6 09:48:56 2010
@@ -0,0 +1,20 @@
+## 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.
+-- -----------------------------------------------------------------------
+-- $torqueGf.option("torque.database") SQL script for schema $name
+-- -----------------------------------------------------------------------
+



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