db-ddlutils-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject svn commit: r381818 - in /db/ddlutils/trunk/src/java/org/apache/ddlutils/platform: db2/Db2ModelReader.java mssql/MSSqlModelReader.java sybase/SybaseModelReader.java
Date Tue, 28 Feb 2006 23:19:03 GMT
Author: tomdz
Date: Tue Feb 28 15:19:00 2006
New Revision: 381818

URL: http://svn.apache.org/viewcvs?rev=381818&view=rev
Log:
Removed duplicated column check from the internal-index tests

Modified:
    db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/db2/Db2ModelReader.java
    db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/mssql/MSSqlModelReader.java
    db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/sybase/SybaseModelReader.java

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/db2/Db2ModelReader.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/db2/Db2ModelReader.java?rev=381818&r1=381817&r2=381818&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/db2/Db2ModelReader.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/db2/Db2ModelReader.java Tue Feb
28 15:19:00 2006
@@ -176,22 +176,12 @@
     		try
     		{
     			Long.parseLong(index.getName().substring(3));
+    			return true;
     		}
     		catch (NumberFormatException ex)
     		{
-    			return false;
+    			// we ignore it
     		}
-
-    		Column[] pks = table.getPrimaryKeyColumns();
-
-    		for (int idx = 0; idx < pks.length; idx++)
-    		{
-    			if (!index.getColumn(idx).getName().equals(pks[idx].getName()))
-    			{
-    				return false;
-    			}
-    		}
-    		return true;
     	}
 		return false;
     }

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=381818&r1=381817&r2=381818&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 Tue
Feb 28 15:19:00 2006
@@ -98,28 +98,12 @@
 	{
 		// Sql Server generates an index "PK__[table name]__[hex number]"
 		StringBuffer pkIndexName = new StringBuffer();
-		Column[]     pks         = table.getPrimaryKeyColumns();
 
-		if (pks.length > 0)
-		{
-			pkIndexName.append("PK__");
-			pkIndexName.append(table.getName());
-			pkIndexName.append("__");
+		pkIndexName.append("PK__");
+		pkIndexName.append(table.getName());
+		pkIndexName.append("__");
 
-			if (index.getName().toUpperCase().startsWith(pkIndexName.toString().toUpperCase()))
-			{
-				// if its an index for the pk, then its columns have to be the pk columns
-				for (int idx = 0; idx < pks.length; idx++)
-				{
-					if (!pks[idx].getName().equals(index.getColumn(idx).getName()))
-					{
-						return false;
-					}
-				}
-				return true;
-			}
-		}
-		return false;
+		return index.getName().toUpperCase().startsWith(pkIndexName.toString().toUpperCase());
 	}
 
     /**

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/sybase/SybaseModelReader.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/sybase/SybaseModelReader.java?rev=381818&r1=381817&r2=381818&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/sybase/SybaseModelReader.java
(original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/sybase/SybaseModelReader.java
Tue Feb 28 15:19:00 2006
@@ -170,22 +170,12 @@
 		    		try
 		    		{
 		    			Long.parseLong(id);
+		    			return true;
 		    		}
 		    		catch (NumberFormatException ex)
 		    		{
-		    			return false;
+		    			// we ignore it
 		    		}
-
-		    		Column[] pks = table.getPrimaryKeyColumns();
-
-		    		for (int idx = 0; idx < pks.length; idx++)
-		    		{
-		    			if (!index.getColumn(idx).getName().equals(pks[idx].getName()))
-		    			{
-		    				return false;
-		    			}
-		    		}
-		    		return true;
 	    		}
 	    	}
     	}



Mime
View raw message