db-ddlutils-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject svn commit: r360541 - /db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/JdbcModelReader.java
Date Sun, 01 Jan 2006 20:24:08 GMT
Author: tomdz
Date: Sun Jan  1 12:24:05 2006
New Revision: 360541

URL: http://svn.apache.org/viewcvs?rev=360541&view=rev
Log:
Added support for the sequence number/ordinal position in foreign keys/indices

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=360541&r1=360540&r2=360541&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 
1 12:24:05 2006
@@ -810,25 +810,15 @@
             knownFks.put(fkName, fk);
         }
 
-        Reference ref      = new Reference();
-        int       position = ((Short)values.get("KEY_SEQ")).intValue() - 1;
+        Reference ref = new Reference();
 
         ref.setForeignColumnName((String)values.get("PKCOLUMN_NAME"));
         ref.setLocalColumnName((String)values.get("FKCOLUMN_NAME"));
-
-        if ((position < 0) || (position >= fk.getReferenceCount()))
-        {
-            while (fk.getReferenceCount() < position)
-            {
-                fk.addReference(null);
-            }
-            fk.addReference(ref);
-        }
-        else
+        if (values.containsKey("KEY_SEQ"))
         {
-            fk.addReference(position, ref);
-            fk.removeReference(position + 1);
+            ref.setSequenceValue(((Short)values.get("KEY_SEQ")).intValue());
         }
+        fk.addReference(ref);
     }
 
     /**
@@ -891,23 +881,14 @@
             knownIndices.put(indexName, index);
         }
 
-        IndexColumn ic       = new IndexColumn();
-        int         position = ((Short)values.get("ORDINAL_POSITION")).intValue() - 1;
+        IndexColumn indexColumn = new IndexColumn();
 
-        ic.setName((String)values.get("COLUMN_NAME"));
-        if ((position < 0) || (position >= index.getColumnCount()))
-        {
-            while (index.getColumnCount() < position)
-            {
-                index.addColumn(null);
-            }
-            index.addColumn(ic);
-        }
-        else
+        indexColumn.setName((String)values.get("COLUMN_NAME"));
+        if (values.containsKey("ORDINAL_POSITION"))
         {
-            index.addColumn(position, ic);
-            index.removeColumn(position + 1);
+            indexColumn.setOrdinalPosition(((Short)values.get("ORDINAL_POSITION")).intValue());
         }
+        index.addColumn(indexColumn);
     }
 
     /**



Mime
View raw message