You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ddlutils-dev@db.apache.org by to...@apache.org on 2006/02/12 12:24:10 UTC

svn commit: r377158 - /db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/mssql/MSSqlModelReader.java

Author: tomdz
Date: Sun Feb 12 03:24:07 2006
New Revision: 377158

URL: http://svn.apache.org/viewcvs?rev=377158&view=rev
Log:
Replaced StringBuilder with StringBuffer

Modified:
    db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/mssql/MSSqlModelReader.java

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/mssql/MSSqlModelReader.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/mssql/MSSqlModelReader.java?rev=377158&r1=377157&r2=377158&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/mssql/MSSqlModelReader.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/mssql/MSSqlModelReader.java Sun Feb 12 03:24:07 2006
@@ -94,8 +94,8 @@
 	protected boolean isInternalPrimaryKeyIndex(Table table, Index index)
 	{
 		// Sql Server generates an index "PK__[table name]__[hex number]"
-		StringBuilder pkIndexName = new StringBuilder();
-		Column[]      pks         = table.getPrimaryKeyColumns();
+		StringBuffer pkIndexName = new StringBuffer();
+		Column[]     pks         = table.getPrimaryKeyColumns();
 
 		if (pks.length > 0)
 		{
@@ -153,6 +153,15 @@
 				if (timestamp != null)
 				{
 					defaultValue = timestamp.toString();
+				}
+			}
+			else if (column.getTypeCode() == Types.DECIMAL)
+			{
+				// For some reason, Sql Server 2005 always returns DECIMAL default values with a dot
+				// even if the scale is 0, so we remove the dot
+				if ((column.getScale() == 0) && defaultValue.endsWith("."))
+				{
+					defaultValue = defaultValue.substring(0, defaultValue.length() - 1);
 				}
 			}
 			column.setDefaultValue(defaultValue);