db-ddlutils-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject svn commit: r373387 - /db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/JdbcModelReader.java
Date Sun, 29 Jan 2006 23:10:58 GMT
Author: tomdz
Date: Sun Jan 29 15:10:55 2006
New Revision: 373387

URL: http://svn.apache.org/viewcvs?rev=373387&view=rev
Log:
Statistic indices are now ignored

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

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/JdbcModelReader.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/JdbcModelReader.java?rev=373387&r1=373386&r2=373387&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/JdbcModelReader.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/JdbcModelReader.java Sun Jan 29
15:10:55 2006
@@ -17,6 +17,7 @@
  */
 
 import java.sql.Connection;
+import java.sql.DatabaseMetaData;
 import java.sql.ResultSet;
 import java.sql.ResultSetMetaData;
 import java.sql.SQLException;
@@ -223,7 +224,7 @@
         result.add(new MetaDataColumnDescriptor("NON_UNIQUE",       Types.BIT, Boolean.TRUE));
         result.add(new MetaDataColumnDescriptor("ORDINAL_POSITION", Types.TINYINT, new Short((short)0)));
         result.add(new MetaDataColumnDescriptor("COLUMN_NAME",      Types.VARCHAR));
-        
+        result.add(new MetaDataColumnDescriptor("TYPE",             Types.TINYINT));
 
         return result;
     }
@@ -865,32 +866,44 @@
      */
     protected void readIndex(DatabaseMetaDataWrapper metaData, Map values, Map knownIndices)
throws SQLException
     {
-        String indexName = (String)values.get("INDEX_NAME");
-        Index  index     = (Index)knownIndices.get(indexName);
+        Short indexType = (Short)values.get("TYPE");
 
-        if ((index == null) && (indexName != null))
+        // we're ignoring statistic indices
+        if ((indexType != null) && (indexType.shortValue() == DatabaseMetaData.tableIndexStatistic))
         {
-            if (((Boolean)values.get("NON_UNIQUE")).booleanValue())
-            {
-                index = new NonUniqueIndex();
-            }
-            else
-            {
-                index = new UniqueIndex();
-            }
-
-            index.setName(indexName);
-            knownIndices.put(indexName, index);
+        	return;
         }
+        
+        String indexName = (String)values.get("INDEX_NAME");
 
-        IndexColumn indexColumn = new IndexColumn();
-
-        indexColumn.setName((String)values.get("COLUMN_NAME"));
-        if (values.containsKey("ORDINAL_POSITION"))
+        if (indexName != null)
         {
-            indexColumn.setOrdinalPosition(((Short)values.get("ORDINAL_POSITION")).intValue());
+	        Index index = (Index)knownIndices.get(indexName);
+	
+	        if (index == null)
+	        {
+	            if (((Boolean)values.get("NON_UNIQUE")).booleanValue())
+	            {
+	                index = new NonUniqueIndex();
+	            }
+	            else
+	            {
+	                index = new UniqueIndex();
+	            }
+
+	            index.setName(indexName);
+	            knownIndices.put(indexName, index);
+	        }
+	
+	        IndexColumn indexColumn = new IndexColumn();
+	
+	        indexColumn.setName((String)values.get("COLUMN_NAME"));
+	        if (values.containsKey("ORDINAL_POSITION"))
+	        {
+	            indexColumn.setOrdinalPosition(((Short)values.get("ORDINAL_POSITION")).intValue());
+	        }
+	        index.addColumn(indexColumn);
         }
-        index.addColumn(indexColumn);
     }
 
     /**
@@ -957,10 +970,12 @@
         }
         query.append(" WHERE 1 = 0");
         
-        Statement         stmt       = null;
+        Statement stmt = null;
+
         try
         {
             stmt = getConnection().createStatement();
+
             ResultSet         rs         = stmt.executeQuery(query.toString());
             ResultSetMetaData rsMetaData = rs.getMetaData();
         



Mime
View raw message