db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gmon...@apache.org
Subject svn commit: r586638 - in /db/torque: site/trunk/xdocs/changes.xml templates/trunk/src/templates/sql/load/mssql/row.vm
Date Fri, 19 Oct 2007 22:58:49 GMT
Author: gmonroe
Date: Fri Oct 19 15:58:48 2007
New Revision: 586638

URL: http://svn.apache.org/viewvc?rev=586638&view=rev
Log:
Fix for TORQUE-86: Allows autogenerated fields to be inserted into MS SQL tables when idBroker
is native.  Thanks to Will Glass-Husain for initial patch.

Modified:
    db/torque/site/trunk/xdocs/changes.xml
    db/torque/templates/trunk/src/templates/sql/load/mssql/row.vm

Modified: db/torque/site/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/db/torque/site/trunk/xdocs/changes.xml?rev=586638&r1=586637&r2=586638&view=diff
==============================================================================
--- db/torque/site/trunk/xdocs/changes.xml (original)
+++ db/torque/site/trunk/xdocs/changes.xml Fri Oct 19 15:58:48 2007
@@ -31,6 +31,11 @@
 
   <body>
   <release version="3.3-RC3" date="in SVN">
+    <action type="change" dev="gmonroe" issue="TORQUE-86" due-to="Will Glass-Husain">
+      The SQL statements generated for MS SQL by the torque:datasql target 
+      will now be wrapped in SET IDENTITY_INSERT...ON /OFF statements if
+      the idMethod is native and autogenerate is set on one or more fields.
+    </action>
     <action type="change" dev="tfischer" issue="TORQUE-69">
       An exception is now thrown on an attempt to update a modified object
       without a primary key. The previous behaviour was to fail silently.
@@ -57,7 +62,7 @@
       The suffix parameter to the Maven2-plugin's sql task now works.
     </action>
     <action type="add" dev="tfischer" issue="TORQUE-99" due-to="Tobias Hilka">
-      Added copy(..) and add<ForeignKey>(..) methods with a connection 
+      Added copy(..) and add&lt;ForeignKey&gt;(..) methods with a connection 
       parameter.
     </action>
     <action type="update" dev="tv">

Modified: db/torque/templates/trunk/src/templates/sql/load/mssql/row.vm
URL: http://svn.apache.org/viewvc/db/torque/templates/trunk/src/templates/sql/load/mssql/row.vm?rev=586638&r1=586637&r2=586638&view=diff
==============================================================================
--- db/torque/templates/trunk/src/templates/sql/load/mssql/row.vm (original)
+++ db/torque/templates/trunk/src/templates/sql/load/mssql/row.vm Fri Oct 19 15:58:48 2007
@@ -14,7 +14,16 @@
 ## KIND, either express or implied.  See the License for the
 ## specific language governing permissions and limitations
 ## under the License.
+#set($hasIdentity = false)
+#if ( $row.Table.IdMethod.equals("native") )
+#foreach($col in $row.ColumnValues)#set($hasIdentity = $hasIdentity || $col.Column.autoIncrement)#end
+#end
+#if($hasIdentity)
+SET IDENTITY_INSERT $row.Table.Name ON;
+#end
 INSERT INTO $row.Table.Name (##
 #set ($comma="")#foreach($col in $row.ColumnValues)$comma${col.Column.Name}#set($comma=",")#end)
     VALUES (#set ($comma="")#foreach($col in $row.ColumnValues)$comma${generator.parse("sql/load/mssql/val.vm",
"", "column", $col)}#set ($comma=",")#end);
-
+#if($hasIdentity)
+SET IDENTITY_INSERT $row.Table.Name OFF;
+#end



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