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 2010/02/16 18:16:02 UTC
svn commit: r910600 [28/29] - in /db/torque/torque4/trunk:
maven-torque-gf-plugin/ maven-torque-gf-plugin/src/
maven-torque-gf-plugin/src/main/ maven-torque-gf-plugin/src/main/java/
maven-torque-gf-plugin/src/main/java/org/ maven-torque-gf-plugin/src/m...
Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/resultSet2Objects.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/resultSet2Objects.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/resultSet2Objects.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/resultSet2Objects.vm Tue Feb 16 17:15:43 2010
@@ -0,0 +1,70 @@
+## 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: MultiExtendBean.vm 240328 2005-08-26 22:02:48 +0200 (Fr, 26 Aug 2005) tfischer $
+##
+## Creates the resultSet2Objects method for the base peer.
+##
+## This template expects the current source element to be a "table" element
+## from the torque schema.
+## The schema needs to be processed by the OMTransformer.
+## The options and the attributes of the current source element must be set
+## as velocity variables.
+##
+ /**
+ * Get the list of objects for a ResultSet. Please not that your
+ * resultset MUST return columns in the right order. You can use
+ * getFieldNames() in BaseObject to get the correct sequence.
+ *
+ * @param results the ResultSet
+ * @return the list of objects
+ * @throws TorqueException Any exceptions caught during processing will be
+ * rethrown wrapped into a TorqueException.
+ */
+ public static List#if($java5 == "true")<${dbObjectClassName}>#end resultSet2Objects(java.sql.ResultSet results)
+ throws TorqueException
+ {
+ try
+ {
+ QueryDataSet qds = null;
+ List#if($java5 == "true")<Record>#end rows = null;
+ try
+ {
+ qds = new QueryDataSet(results);
+ rows = ${peerClassName}.getSelectResults(qds);
+ }
+ finally
+ {
+ if (qds != null)
+ {
+ qds.close();
+ }
+ }
+
+ return ${peerClassName}.populateObjects(rows);
+ }
+ catch (SQLException e)
+ {
+ throw new TorqueException(e);
+ }
+ catch (DataSetException e)
+ {
+ throw new TorqueException(e);
+ }
+ }
Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/retrieveByPK.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/retrieveByPK.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/retrieveByPK.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/retrieveByPK.vm Tue Feb 16 17:15:43 2010
@@ -0,0 +1,200 @@
+## 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: MultiExtendBean.vm 240328 2005-08-26 22:02:48 +0200 (Fr, 26 Aug 2005) tfischer $
+##
+## Creates the retrieveByPk methods for the base peer.
+##
+## This template expects the current source element to be a "table" element
+## from the torque schema.
+## The schema needs to be processed by the OMTransformer.
+## The options and the attributes of the current source element must be set
+## as velocity variables.
+##
+#set ( $primaryKeyColumnElements = $torqueGf.getChild("primary-keys").getChildren("column"))
+#if (!$primaryKeyColumnElements.isEmpty())
+ #if ($primaryKeyColumnElements.size() == 1)
+ #set ( $columnElement = $primaryKeyColumnElements.get(0) )
+ #set ( $fieldType = $columnElement.getAttribute("fieldType"))
+ /**
+ * Retrieve a single object by pk
+ *
+ * @param pk the primary key
+ * @throws TorqueException Any exceptions caught during processing will be
+ * rethrown wrapped into a TorqueException.
+ * @throws NoRowsException Primary key was not found in database.
+ * @throws TooManyRowsException Primary key was not found in database.
+ */
+ public static $dbObjectClassName retrieveByPK($fieldType pk)
+ throws TorqueException, NoRowsException, TooManyRowsException
+ {
+ return ${peerClassName}.retrieveByPK(SimpleKey.keyFor(pk));
+ }
+
+ /**
+ * Retrieve a single object by pk
+ *
+ * @param pk the primary key
+ * @param con the connection to use
+ * @throws TorqueException Any exceptions caught during processing will be
+ * rethrown wrapped into a TorqueException.
+ * @throws NoRowsException Primary key was not found in database.
+ * @throws TooManyRowsException Primary key was not found in database.
+ */
+ public static $dbObjectClassName retrieveByPK($fieldType pk, Connection con)
+ throws TorqueException, NoRowsException, TooManyRowsException
+ {
+ return ${peerClassName}.retrieveByPK(SimpleKey.keyFor(pk), con);
+ }
+
+
+
+ #elseif ($primaryKeyColumnElements.size() > 1)
+ /**
+ * retrieve object using using pk values.
+ *
+ #foreach ($columnElement in $primaryKeyColumnElements)
+ #set ( $field = $columnElement.getAttribute("field") )
+ #set ( $fieldType = $columnElement.getAttribute("fieldType") )
+ * @param $field $fieldType
+ #end
+ */
+ public static $dbObjectClassName retrieveByPK(
+ #set ( $elementCount = 1 )
+ #foreach ($columnElement in $primaryKeyColumnElements)
+ #set ( $field = $columnElement.getAttribute("field") )
+ #set ( $fieldType = $columnElement.getAttribute("fieldType") )
+ $fieldType $field#if($elementCount != $primaryKeyColumnElements.size()),#else)#end
+
+ #set ( $elementCount = $elementCount + 1 )
+ #end
+ throws TorqueException
+ {
+ Connection db = null;
+ $dbObjectClassName retVal = null;
+ try
+ {
+ db = Torque.getConnection(DATABASE_NAME);
+ retVal = retrieveByPK(
+ #foreach ($columnElement in $primaryKeyColumnElements)
+ #set ( $field = $columnElement.getAttribute("field") )
+ ${field},
+ #end
+ db);
+ }
+ finally
+ {
+ Torque.closeConnection(db);
+ }
+ return retVal;
+ }
+
+ /**
+ * retrieve object using using pk values.
+ *
+ #foreach ($columnElement in $primaryKeyColumnElements)
+ #set ( $field = $columnElement.getAttribute("field") )
+ #set ( $fieldType = $columnElement.getAttribute("fieldType") )
+ * @param $field $fieldType
+ #end
+ * @param con Connection
+ */
+ public static $dbObjectClassName retrieveByPK(
+ #foreach ($columnElement in $primaryKeyColumnElements)
+ #set ( $field = $columnElement.getAttribute("field") )
+ #set ( $fieldType = $columnElement.getAttribute("fieldType") )
+ $fieldType ${field},
+ #end
+ Connection con) throws TorqueException
+ {
+
+ Criteria criteria = new Criteria(5);
+ #foreach ($columnElement in $primaryKeyColumnElements)
+ #set ( $field = $columnElement.getAttribute("field") )
+ #set ( $peerColumnName = $columnElement.getAttribute("peerColumnName") )
+ criteria.add($peerColumnName, $field);
+ #end
+ List#if($java5 == "true")<${dbObjectClassName}>#end v = doSelect(criteria, con);
+ if (v.size() == 1)
+ {
+ return #if($java5 != "true")(${dbObjectClassName})#end v.get(0);
+ }
+ else
+ {
+ throw new TorqueException("Failed to select one and only one row.");
+ }
+ }
+ #end
+
+ /**
+ * Retrieve a single object by pk
+ *
+ * @param pk the primary key
+ * @throws TorqueException Any exceptions caught during processing will be
+ * rethrown wrapped into a TorqueException.
+ * @throws NoRowsException Primary key was not found in database.
+ * @throws TooManyRowsException Primary key was not found in database.
+ */
+ public static $dbObjectClassName retrieveByPK(ObjectKey pk)
+ throws TorqueException, NoRowsException, TooManyRowsException
+ {
+ Connection db = null;
+ $dbObjectClassName retVal;
+ try
+ {
+ db = Torque.getConnection(DATABASE_NAME);
+ retVal = ${peerClassName}.retrieveByPK(pk, db);
+ }
+ finally
+ {
+ Torque.closeConnection(db);
+ }
+ return retVal;
+ }
+
+ /**
+ * Retrieve a single object by pk
+ *
+ * @param pk the primary key
+ * @param con the connection to use
+ * @throws TorqueException Any exceptions caught during processing will be
+ * rethrown wrapped into a TorqueException.
+ * @throws NoRowsException Primary key was not found in database.
+ * @throws TooManyRowsException Primary key was not found in database.
+ */
+ public static $dbObjectClassName retrieveByPK(ObjectKey pk, Connection con)
+ throws TorqueException, NoRowsException, TooManyRowsException
+ {
+ Criteria criteria = buildCriteria(pk);
+ List#if($java5 == "true")<${dbObjectClassName}>#end v = ${peerClassName}.doSelect(criteria, con);
+ if (v.size() == 0)
+ {
+ throw new NoRowsException("Failed to select a row.");
+ }
+ else if (v.size() > 1)
+ {
+ throw new TooManyRowsException("Failed to select only one row.");
+ }
+ else
+ {
+ return ($dbObjectClassName)v.get(0);
+ }
+ }
+
+#end
\ No newline at end of file
Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/retrieveByPKs.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/retrieveByPKs.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/retrieveByPKs.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/retrieveByPKs.vm Tue Feb 16 17:15:43 2010
@@ -0,0 +1,103 @@
+## 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: MultiExtendBean.vm 240328 2005-08-26 22:02:48 +0200 (Fr, 26 Aug 2005) tfischer $
+##
+## Creates the retrieveByPks methods for the base peer.
+##
+## This template expects the current source element to be a "table" element
+## from the torque schema.
+## The schema needs to be processed by the OMTransformer.
+## The options and the attributes of the current source element must be set
+## as velocity variables.
+##
+#set ( $primaryKeyColumnElements = $torqueGf.getChild("primary-keys").getChildren("column"))
+#if (!$primaryKeyColumnElements.isEmpty())
+ /**
+ * Retrieve a multiple objects by pk
+ *
+ * @param pks List of primary keys
+ * @throws TorqueException Any exceptions caught during processing will be
+ * rethrown wrapped into a TorqueException.
+ */
+ public static List#if($java5 == "true")<${dbObjectClassName}>#end retrieveByPKs(List#if($java5 == "true")<ObjectKey>#end pks)
+ throws TorqueException
+ {
+ Connection db = null;
+ List#if($java5 == "true")<${dbObjectClassName}>#end retVal = null;
+ try
+ {
+ db = Torque.getConnection(DATABASE_NAME);
+ retVal = ${peerClassName}.retrieveByPKs(pks, db);
+ }
+ finally
+ {
+ Torque.closeConnection(db);
+ }
+ return retVal;
+ }
+
+ /**
+ * Retrieve multiple objects by pk
+ *
+ * @param pks List of primary keys
+ * @param dbcon the connection to use
+ * @throws TorqueException Any exceptions caught during processing will be
+ * rethrown wrapped into a TorqueException.
+ */
+ public static List#if($java5 == "true")<${dbObjectClassName}>#end retrieveByPKs(List#if($java5 == "true")<ObjectKey>#end pks, Connection dbcon)
+ throws TorqueException
+ {
+ List#if($java5 == "true")<${dbObjectClassName}>#end objs = null;
+ if (pks == null || pks.size() == 0)
+ {
+ objs = new LinkedList#if($java5 == "true")<${dbObjectClassName}>#end();
+ }
+ else
+ {
+ Criteria criteria = new Criteria();
+ #set ( $columnElement = $primaryKeyColumnElements.get(0) )
+ #set ( $peerColumnName = $columnElement.getAttribute("peerColumnName"))
+ #if ($primaryKeyColumnElements.size() == 1)
+ criteria.addIn(${peerClassName}.$peerColumnName, pks);
+ #else
+ Iterator#if($java5 == "true")<ObjectKey>#end iter = pks.iterator();
+ while (iter.hasNext())
+ {
+ ObjectKey pk = #if(!$java5 == "true")(ObjectKey)#end iter.next();
+ SimpleKey[] keys = (SimpleKey[])pk.getValue();
+ #set ( $i = 0 )
+ #foreach ($primaryKeyColumnElement in $primaryKeyColumnElements)
+ Criteria.Criterion c$i = criteria.getNewCriterion(
+ ${peerClassName}.$peerColumnName, keys[$i], Criteria.EQUAL);
+ #set ( $j = $i - 1 )
+ #if ($i > 0)
+ c${j}.and(c${i});
+ #end
+ #set ( $i = $i + 1 )
+ #end
+ criteria.or(c0);
+ }
+ #end
+ objs = ${peerClassName}.doSelect(criteria, dbcon);
+ }
+ return objs;
+ }
+
+#end
\ No newline at end of file
Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/row2Object.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/row2Object.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/row2Object.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/row2Object.vm Tue Feb 16 17:15:43 2010
@@ -0,0 +1,60 @@
+## 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: MultiExtendBean.vm 240328 2005-08-26 22:02:48 +0200 (Fr, 26 Aug 2005) tfischer $
+##
+## Creates the row2Object method in the base peer.
+##
+## This template expects the current source element to be a "table" element
+## from the torque schema.
+## The schema needs to be processed by the OMTransformer.
+## The options and the attributes of the current source element must be set
+## as velocity variables.
+##
+ /**
+ * Create a new object of type cls from a resultset row starting
+ * from a specified offset. This is done so that you can select
+ * other rows than just those needed for this object. You may
+ * for example want to create two objects from the same row.
+ *
+ * @throws TorqueException Any exceptions caught during processing will be
+ * rethrown wrapped into a TorqueException.
+ */
+ public static $dbObjectClassName row2Object(Record row,
+ int offset,
+ Class cls)
+ throws TorqueException
+ {
+ try
+ {
+ $dbObjectClassName obj = ($dbObjectClassName) cls.newInstance();
+ ${peerClassName}.populateObject(row, offset, obj);
+ obj.setNew(false);
+ obj.setModified(false);
+ return obj;
+ }
+ catch (InstantiationException e)
+ {
+ throw new TorqueException(e);
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new TorqueException(e);
+ }
+ }
Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/setDbName.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/setDbName.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/setDbName.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/setDbName.vm Tue Feb 16 17:15:43 2010
@@ -0,0 +1,34 @@
+## 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: MultiExtendBean.vm 240328 2005-08-26 22:02:48 +0200 (Fr, 26 Aug 2005) tfischer $
+##
+## Creates the setDbName method for the base peer.
+## This template expects no input.
+##
+ private static void setDbName(Criteria crit)
+ {
+ // Set the correct dbName if it has not been overridden
+ // crit.getDbName will return the same object if not set to
+ // another value so == check is okay and faster
+ if (crit.getDbName() == Torque.getDefaultDB())
+ {
+ crit.setDbName(DATABASE_NAME);
+ }
+ }
Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/staticInit.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/staticInit.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/staticInit.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/staticInit.vm Tue Feb 16 17:15:43 2010
@@ -0,0 +1,35 @@
+## 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: MultiExtendBean.vm 240328 2005-08-26 22:02:48 +0200 (Fr, 26 Aug 2005) tfischer $
+##
+## Creates the static initializer for a base peer object.
+##
+## This template expects the current source element to be a "table" element
+## from the torque schema.
+## The schema needs to be processed by the OMTransformer.
+## The options and the attributes of the current source element must be set
+## as velocity variables.
+##
+ static
+ {
+$torqueGf.mergepoint("tableDatabaseNameConstantsInit")
+$torqueGf.mergepoint("columnConstantsInit")
+$torqueGf.mergepoint("mapBuilderInit")##
+ }
Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/tableDatabaseNameConstants.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/tableDatabaseNameConstants.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/tableDatabaseNameConstants.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/tableDatabaseNameConstants.vm Tue Feb 16 17:15:43 2010
@@ -0,0 +1,30 @@
+## 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: MultiExtendBean.vm 240328 2005-08-26 22:02:48 +0200 (Fr, 26 Aug 2005) tfischer $
+##
+## Generates the constants for the database name and table name in the
+## base peer class
+## This template expects no input.
+##
+ /** the default database name for this class */
+ public static final String DATABASE_NAME;
+
+ /** the table name for this class */
+ public static final String TABLE_NAME;
\ No newline at end of file
Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/tableDatabaseNameConstantsInit.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/tableDatabaseNameConstantsInit.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/tableDatabaseNameConstantsInit.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/tableDatabaseNameConstantsInit.vm Tue Feb 16 17:15:43 2010
@@ -0,0 +1,31 @@
+## 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: MultiExtendBean.vm 240328 2005-08-26 22:02:48 +0200 (Fr, 26 Aug 2005) tfischer $
+##
+## Initializes the constants for the database and table names in the
+## base peer class.
+##
+## This template expects the current source element to be a "table" element
+## from the torque schema.
+## The options and the attributes of the current source element must be set
+## as velocity variables.
+##
+ DATABASE_NAME = "$torqueGf.getParent().getAttribute("name")";
+ TABLE_NAME = "$name";
Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/classJavadoc.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/classJavadoc.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/classJavadoc.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/classJavadoc.vm Tue Feb 16 17:15:43 2010
@@ -0,0 +1,40 @@
+## 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: MultiExtendBean.vm 240328 2005-08-26 22:02:48 +0200 (Fr, 26 Aug 2005) tfischer $
+##
+## Creates the class javadoc for a peer object.
+## This template expects as input a "table" element from the torque schema
+## which was processed by the OMTransformer.
+##
+/**
+#if ($description)
+ * $description
+ *
+#end
+#if ($torqueGf.booleanOption("torque.om.addTimeStamp"))
+ * The skeleton for this class was autogenerated by Torque on:
+ *
+ * [${torqueGf.now()}]
+ *
+#end
+ * You should add additional methods to this class to meet the
+ * application requirements. This class will only be generated as
+ * long as it does not already exist in the output directory.
+ */
Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/peer.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/peer.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/peer.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/peer.vm Tue Feb 16 17:15:43 2010
@@ -0,0 +1,34 @@
+## 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: MultiExtendBean.vm 240328 2005-08-26 22:02:48 +0200 (Fr, 26 Aug 2005) tfischer $
+##
+## Creates the peer class.
+## This template expects as input a "table" element from the torque schema
+## which was processed by the OMTransformer.
+##
+package ${peerPackage};
+
+$torqueGf.mergepoint("classJavadoc")
+public class ${peerClassName}
+ extends ${basePeerPackage}.${basePeerClassName}
+{
+$torqueGf.mergepoint("serialVersionUid")
+$torqueGf.mergepoint("extensions")
+}
Added: 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=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/conf/control.xml (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/conf/control.xml Tue Feb 16 17:15:43 2010
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+
+<control loglevel="info"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ 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.ddl" file="schema.sql">
+ <filenameGenerator
+ xsi:type="javaGenerator"
+ class="org.apache.torque.gf.generator.java.ModifySourcenameGenerator">
+ <discardFrom>.</discardFrom>
+ <suffix>.sql</suffix>
+ </filenameGenerator>
+ <source elements="database" path="*schema.xml">
+ <transformer class="org.apache.torque.templates.transformer.sql.SQLTransformer"/>
+ </source>
+ <generator name="torque.sql.ddl.database"/>
+ </output>
+
+</control>
+
\ No newline at end of file
Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/conf/options.properties
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/conf/options.properties?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/conf/options.properties (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/conf/options.properties Tue Feb 16 17:15:43 2010
@@ -0,0 +1,16 @@
+# 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.
Added: 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=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/generatorDefs/ddl.xml (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/generatorDefs/ddl.xml Tue Feb 16 17:15:43 2010
@@ -0,0 +1,121 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+
+<generators xmlns="http://db.apache.org/torque/gf/4.0/configuration"
+ xsi:schemaLocation="http://db.apache.org/torque/gf/4.0/configuration http://db.apache.org/torque/gf/4.0/generator.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <generator name="torque.sql.ddl.database"
+ xsi:type="velocityGenerator"
+ path="ddl/database.vm">
+ <mergepoint name="tables">
+ <action xsi:type="traverseAllAction"
+ element="table"
+ generator="torque.sql.ddl.table"/>
+ </mergepoint>
+ <mergepoint name="foreignKeys">
+ <action xsi:type="traverseAllAction"
+ element="table/foreign-key"
+ generator="torque.sql.ddl.foreignKey"/>
+ </mergepoint>
+ <mergepoint name="comments">
+ <action xsi:type="traverseAllAction"
+ element="table"
+ generator="torque.sql.ddl.tableComment"/>
+ <action xsi:type="traverseAllAction"
+ element="table/column"
+ generator="torque.sql.ddl.columnComment"/>
+ </mergepoint>
+ </generator>
+
+ <generator name="torque.sql.ddl.table"
+ xsi:type="velocityGenerator"
+ path="ddl/${option:database}/table.vm">
+ <mergepoint name="drop">
+ <action xsi:type="applyAction"
+ generator="torque.sql.ddl.drop"/>
+ </mergepoint>
+ <mergepoint name="columns">
+ <action xsi:type="traverseAllAction"
+ element="column"
+ generator="torque.sql.ddl.column"/>
+ </mergepoint>
+ <mergepoint name="primaryKey">
+ <action xsi:type="applyAction"
+ generator="torque.sql.ddl.primaryKey"/>
+ </mergepoint>
+ <mergepoint name="unique">
+ <action xsi:type="traverseAllAction"
+ element="unique"
+ generator="torque.sql.ddl.unique"/>
+ </mergepoint>
+ <mergepoint name="index">
+ <action xsi:type="traverseAllAction"
+ element="index"
+ generator="torque.sql.ddl.index"/>
+ </mergepoint>
+ <mergepoint name="sequence">
+ <action xsi:type="applyAction"
+ generator="torque.sql.ddl.sequence"/>
+ </mergepoint>
+ </generator>
+
+ <generator name="torque.sql.ddl.drop"
+ xsi:type="velocityGenerator"
+ path="ddl/${option:database}/drop.vm" />
+
+ <generator name="torque.sql.ddl.column"
+ xsi:type="velocityGenerator"
+ path="ddl/column.vm" />
+
+ <generator name="torque.sql.ddl.primaryKey"
+ xsi:type="velocityGenerator"
+ path="ddl/${option:database}/primaryKey.vm" />
+
+ <generator name="torque.sql.ddl.unique"
+ xsi:type="velocityGenerator"
+ path="ddl/${option:database}/unique.vm" />
+
+ <generator name="torque.sql.ddl.index"
+ xsi:type="velocityGenerator"
+ path="ddl/${option:database}/index.vm" />
+
+ <generator name="torque.sql.ddl.sequence"
+ xsi:type="velocityGenerator"
+ path="ddl/${option:database}/sequence.vm" />
+
+ <generator name="torque.sql.ddl.tableComment"
+ xsi:type="velocityGenerator"
+ path="ddl/${option:database}/tableComment.vm">
+ <mergepoint name="columnComments">
+ <action xsi:type="traverseAllAction"
+ element="column"
+ generator="torque.sql.ddl.columnComment"/>
+ </mergepoint>
+ </generator>
+
+ <generator name="torque.sql.ddl.columnComment"
+ xsi:type="velocityGenerator"
+ path="ddl/${option:database}/columnComment.vm" />
+
+ <generator name="torque.sql.ddl.foreignKey"
+ xsi:type="velocityGenerator"
+ path="ddl/${option:database}/foreignKey.vm" />
+</generators>
\ No newline at end of file
Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/column.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/column.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/column.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/column.vm Tue Feb 16 17:15:43 2010
@@ -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.
+##
+ ${name} ${ddlSql},
Added: 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=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/database.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/database.vm Tue Feb 16 17:15:43 2010
@@ -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.
+# -----------------------------------------------------------------------
+# $torqueGf.option("torque.database") SQL script for schema $name
+# -----------------------------------------------------------------------
+
+$torqueGf.mergepoint("databaseStart")
+$torqueGf.mergepoint("tables")
+$torqueGf.mergepoint("foreignKeys")
+$torqueGf.mergepoint("comments")
+$torqueGf.mergepoint("databaseEnd")
\ No newline at end of file
Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mssql/columnComment.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mssql/columnComment.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mssql/columnComment.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mssql/columnComment.vm Tue Feb 16 17:15:43 2010
@@ -0,0 +1,17 @@
+## 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/drop.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mssql/drop.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mssql/drop.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mssql/drop.vm Tue Feb 16 17:15:43 2010
@@ -0,0 +1,48 @@
+## 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.
+#set ($foreignKeyElements = $torqueGf.getChildren("foreign-key"))
+#foreach ($foreignKeyElement in $foreignKeyElements)
+ #set ($foreignKeyName = $foreignKeyElement.getAttribute("name"))
+IF EXISTS (SELECT 1 FROM sysobjects WHERE type ='RI' AND name='$foreignKeyName')
+ ALTER TABLE $name DROP CONSTRAINT $foreignKeyName;
+#end
+IF EXISTS (SELECT 1 FROM sysobjects WHERE type = 'U' AND name = '$name')
+BEGIN
+#set ($counter = ${torqueGf.getCounter()})
+ DECLARE @reftable_${counter} nvarchar(60), @constraintname_${counter} nvarchar(60)
+ DECLARE refcursor CURSOR FOR
+ select reftables.name tablename, cons.name constraintname
+ from sysobjects tables,
+ sysobjects reftables,
+ sysobjects cons,
+ sysreferences ref
+ where tables.id = ref.rkeyid
+ and cons.id = ref.constid
+ and reftables.id = ref.fkeyid
+ and tables.name = '$name'
+ OPEN refcursor
+ FETCH NEXT from refcursor into @reftable_${counter}, @constraintname_${counter}
+ while @@FETCH_STATUS = 0
+ BEGIN
+ exec ('alter table '+@reftable_${counter}+' drop constraint '+@constraintname_${counter})
+ FETCH NEXT from refcursor into @reftable_${counter}, @constraintname_${counter}
+ END
+ CLOSE refcursor
+ DEALLOCATE refcursor
+ DROP TABLE $name
+END
+;
Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mssql/foreignKey.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mssql/foreignKey.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mssql/foreignKey.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mssql/foreignKey.vm Tue Feb 16 17:15:43 2010
@@ -0,0 +1,33 @@
+## 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.
+#set ( $tableName = $torqueGf.getParent().getAttribute("name") )
+BEGIN
+ALTER TABLE $tableName
+ ADD CONSTRAINT $name
+ FOREIGN KEY ($localColumnNames)
+ REFERENCES $foreignTable ($foreignColumnNames)##
+#if ($onUpdate)
+
+ ON UPDATE $onUpdate##
+#end
+#if ($onDelete)
+
+ ON DELETE $onDelete##
+#end
+END
+;
+
Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mssql/index.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mssql/index.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mssql/index.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mssql/index.vm Tue Feb 16 17:15:43 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.
+#set ( $tableName = $torqueGf.getParent().getAttribute("name") )
+#if ($indexColumnNames != "")
+CREATE INDEX#if($name) $name#end ON $tableName ($indexColumnNames);
+#end
Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mssql/primaryKey.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mssql/primaryKey.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mssql/primaryKey.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mssql/primaryKey.vm Tue Feb 16 17:15:43 2010
@@ -0,0 +1,19 @@
+## 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.
+#if ($primaryKeyColumnNames != "")
+ CONSTRAINT ${name}_PK PRIMARY KEY($primaryKeyColumnNames),
+#end
Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mssql/sequence.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mssql/sequence.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mssql/sequence.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mssql/sequence.vm Tue Feb 16 17:15:43 2010
@@ -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 sequences in mssql
Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mssql/table.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mssql/table.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mssql/table.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mssql/table.vm Tue Feb 16 17:15:43 2010
@@ -0,0 +1,34 @@
+## 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.
+
+/* ---------------------------------------------------------------------- */
+/* $name */
+/* ---------------------------------------------------------------------- */
+$torqueGf.mergepoint("drop")
+CREATE TABLE $name
+(
+#set ( $cols = $torqueGf.mergepoint("columns") )
+#set ( $pk = $torqueGf.mergepoint("primaryKey") )
+#set ( $unique = $torqueGf.mergepoint("unique") )
+#if($stringUtils.allEmpty([$pk,$unique]))$stringUtils.chop($cols,2)#else$cols#end
+#if($stringUtils.allEmpty([$unique]) && $pk.length()>0)$stringUtils.chop($pk,2)#else$pk#end
+#if($unique.length() > 0)$stringUtils.chop($unique,2)#end
+
+)##
+$torqueGf.mergepoint("createOptions")##
+;
+$torqueGf.mergepoint("index")
Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mssql/tableComment.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mssql/tableComment.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mssql/tableComment.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mssql/tableComment.vm Tue Feb 16 17:15:43 2010
@@ -0,0 +1,17 @@
+## 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 mssql
Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mssql/unique.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mssql/unique.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mssql/unique.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mssql/unique.vm Tue Feb 16 17:15:43 2010
@@ -0,0 +1,19 @@
+## 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.
+#if ($uniqueColumnNames != "")
+ UNIQUE($uniqueColumnNames),
+#end
Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mysql/columnComment.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mysql/columnComment.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mysql/columnComment.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mysql/columnComment.vm Tue Feb 16 17:15:43 2010
@@ -0,0 +1,17 @@
+## 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 mysql
Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mysql/drop.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mysql/drop.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mysql/drop.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mysql/drop.vm Tue Feb 16 17:15:43 2010
@@ -0,0 +1,17 @@
+## 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.
+drop table if exists $name;
Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mysql/foreignKey.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mysql/foreignKey.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mysql/foreignKey.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mysql/foreignKey.vm Tue Feb 16 17:15:43 2010
@@ -0,0 +1,30 @@
+## 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.
+ALTER TABLE $torqueGf.getParent().getAttribute("name")
+ ADD CONSTRAINT $name
+ FOREIGN KEY ($localColumnNames)
+ REFERENCES $foreignTable ($foreignColumnNames)##
+#if ($onUpdate)
+
+ ON UPDATE $onUpdate##
+#end
+#if ($onDelete)
+
+ ON DELETE $onDelete##
+#end
+;
+
Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mysql/index.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mysql/index.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mysql/index.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mysql/index.vm Tue Feb 16 17:15:43 2010
@@ -0,0 +1,19 @@
+## 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.
+#if ($indexColumnNames != "")
+ INDEX#if($name) $name#end($indexColumnNames),
+#end
Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mysql/primaryKey.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mysql/primaryKey.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mysql/primaryKey.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mysql/primaryKey.vm Tue Feb 16 17:15:43 2010
@@ -0,0 +1,19 @@
+## 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.
+#if ($primaryKeyColumnNames != "")
+ PRIMARY KEY($primaryKeyColumnNames),
+#end
Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mysql/sequence.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mysql/sequence.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mysql/sequence.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mysql/sequence.vm Tue Feb 16 17:15:43 2010
@@ -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 sequences in mysql
Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mysql/table.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mysql/table.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mysql/table.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mysql/table.vm Tue Feb 16 17:15:43 2010
@@ -0,0 +1,36 @@
+## 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.
+
+# -----------------------------------------------------------------------
+# $name
+# -----------------------------------------------------------------------
+$torqueGf.mergepoint("drop")
+CREATE TABLE $name
+(
+#set ( $cols = $torqueGf.mergepoint("columns") )
+#set ( $pk = $torqueGf.mergepoint("primaryKey") )
+#set ( $unique = $torqueGf.mergepoint("unique") )
+#set ( $index = $torqueGf.mergepoint("index") )
+#if($stringUtils.allEmpty([$pk,$unique,$index]))$stringUtils.chop($cols,2)#else$cols#end
+#if($stringUtils.allEmpty([$unique,$index]) && $pk.length()>0)$stringUtils.chop($pk,2)#else$pk#end
+#if($stringUtils.allEmpty([$index]) && $unique.length()>0)$stringUtils.chop($unique,2)#else$unique#end
+#if($index.length()>0)$stringUtils.chop($index,2)#end
+
+)##
+$torqueGf.mergepoint("createOptions")##
+;
+
Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mysql/tableComment.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mysql/tableComment.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mysql/tableComment.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mysql/tableComment.vm Tue Feb 16 17:15:43 2010
@@ -0,0 +1,17 @@
+## 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 mysql
Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mysql/unique.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mysql/unique.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mysql/unique.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mysql/unique.vm Tue Feb 16 17:15:43 2010
@@ -0,0 +1,19 @@
+## 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.
+#if ($uniqueColumnNames != "")
+ UNIQUE($uniqueColumnNames),
+#end
Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/oracle/columnComment.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/oracle/columnComment.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/oracle/columnComment.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/oracle/columnComment.vm Tue Feb 16 17:15:43 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.
+#if ($description.length() > 0)
+#set ( $tableName = $torqueGf.getParent().getAttribute("name") )
+COMMENT ON COLUMN ${tableName}.${name} IS '$description';
+#end
Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/oracle/drop.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/oracle/drop.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/oracle/drop.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/oracle/drop.vm Tue Feb 16 17:15:43 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.
+DROP TABLE $name CASCADE CONSTRAINTS;
+#if ($idMethod == "native")
+DROP SEQUENCE $sequenceName;
+#end
Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/oracle/foreignKey.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/oracle/foreignKey.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/oracle/foreignKey.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/oracle/foreignKey.vm Tue Feb 16 17:15:43 2010
@@ -0,0 +1,32 @@
+## 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.
+ALTER TABLE $torqueGf.getParent().getAttribute("name")
+ ADD CONSTRAINT $name
+ FOREIGN KEY ($localColumnNames)
+ REFERENCES $foreignTable ($foreignColumnNames)##
+#if ($onUpdate && !$onUpdate.equalsIgnoreCase("cascade"))
+
+ ON UPDATE $onUpdate##
+#end
+#if ($onDelete)
+ #if ( $onDelete.equalsIgnoreCase("setnull") )
+ #set( $onDelete = "SET NULL" )
+ #end
+
+ ON DELETE $onDelete##
+#end
+;
Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/oracle/index.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/oracle/index.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/oracle/index.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/oracle/index.vm Tue Feb 16 17:15:43 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.
+#set ( $tableName = $torqueGf.getParent().getAttribute("name") )
+#if ($indexColumnNames != "")
+CREATE INDEX#if($name) $name#end ON $tableName ($indexColumnNames);
+#end
Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/oracle/primaryKey.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/oracle/primaryKey.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/oracle/primaryKey.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/oracle/primaryKey.vm Tue Feb 16 17:15:43 2010
@@ -0,0 +1,21 @@
+## 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.
+#if ($primaryKeyColumnNames != "")
+ALTER TABLE $name
+ ADD CONSTRAINT ${primaryKeyConstraintName}
+ PRIMARY KEY($primaryKeyColumnNames);
+#end
Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/oracle/sequence.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/oracle/sequence.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/oracle/sequence.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/oracle/sequence.vm Tue Feb 16 17:15:43 2010
@@ -0,0 +1,19 @@
+## 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.
+#if ($idMethod == "native")
+CREATE SEQUENCE $sequenceName INCREMENT BY 1 START WITH 1 NOMAXVALUE NOCYCLE NOCACHE ORDER;
+#end
Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/oracle/table.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/oracle/table.vm?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/oracle/table.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/oracle/table.vm Tue Feb 16 17:15:43 2010
@@ -0,0 +1,35 @@
+## 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.
+
+-----------------------------------------------------------------------------
+-- $name
+-----------------------------------------------------------------------------
+$torqueGf.mergepoint("drop")
+CREATE TABLE $name
+(
+#set ( $cols = $torqueGf.mergepoint("columns") )
+#set ( $unique = $torqueGf.mergepoint("unique") )
+#if($stringUtils.allEmpty([$unique]))$stringUtils.chop($cols,2)#else$cols#end
+#if($unique.length()>0)$stringUtils.chop($unique,2)#end
+
+)##
+$torqueGf.mergepoint("createOptions")##
+;
+
+$torqueGf.mergepoint("primaryKey")
+$torqueGf.mergepoint("index")
+$torqueGf.mergepoint("sequence")
---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org