db-ddlutils-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject svn commit: r572506 - in /db/ddlutils/trunk/src/java/org/apache/ddlutils/model: Database.java TypeMap.java
Date Tue, 04 Sep 2007 04:07:03 GMT
Author: tomdz
Date: Mon Sep  3 21:07:03 2007
New Revision: 572506

URL: http://svn.apache.org/viewvc?rev=572506&view=rev
Log:
Minor enhancements

Modified:
    db/ddlutils/trunk/src/java/org/apache/ddlutils/model/Database.java
    db/ddlutils/trunk/src/java/org/apache/ddlutils/model/TypeMap.java

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/model/Database.java
URL: http://svn.apache.org/viewvc/db/ddlutils/trunk/src/java/org/apache/ddlutils/model/Database.java?rev=572506&r1=572505&r2=572506&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/model/Database.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/model/Database.java Mon Sep  3 21:07:03
2007
@@ -335,6 +335,10 @@
                         fk.setForeignTable(targetTable);
                     }
                 }
+                if (fk.getReferenceCount() == 0)
+                {
+                    throw new ModelException("The foreignkey "+fkDesc+" in table "+curTable.getName()+"
does not have any references");
+                }
                 for (int refIdx = 0; refIdx < fk.getReferenceCount(); refIdx++)
                 {
                     Reference ref = fk.getReference(refIdx);
@@ -381,6 +385,10 @@
                         throw new ModelException("There are multiple indices in table "+curTable.getName()+"
with the name "+indexName);
                     }
                     namesOfProcessedIndices.add(indexName);
+                }
+                if (index.getColumnCount() == 0)
+                {
+                    throw new ModelException("The index "+indexDesc+" in table "+curTable.getName()+"
does not have any columns");
                 }
 
                 for (int indexColumnIdx = 0; indexColumnIdx < index.getColumnCount();
indexColumnIdx++)

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/model/TypeMap.java
URL: http://svn.apache.org/viewvc/db/ddlutils/trunk/src/java/org/apache/ddlutils/model/TypeMap.java?rev=572506&r1=572505&r2=572506&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/model/TypeMap.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/model/TypeMap.java Mon Sep  3 21:07:03
2007
@@ -20,8 +20,10 @@
  */
 
 import java.sql.Types;
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashSet;
+import java.util.Iterator;
 import java.util.Set;
 
 import org.apache.ddlutils.util.Jdbc3Utils;
@@ -145,6 +147,23 @@
         _typeNameToTypeCode.put("BOOLEANCHAR", new Integer(Types.CHAR));
     }
 
+    /**
+     * Returns all supported JDBC types.
+     * 
+     * @return The type codes ({@link java.sql.Types} constants)
+     */
+    public static int[] getSuportedJdbcTypes()
+    {
+        int[] typeCodes = new int[_typeCodeToTypeName.size()];
+        int   idx       = 0;
+
+        for (Iterator it = _typeCodeToTypeName.keySet().iterator(); it.hasNext(); idx++)
+        {
+            typeCodes[idx] = ((Integer)it.next()).intValue();
+        }
+        return typeCodes;
+    }
+    
     /**
      * Returns the JDBC type code (one of the {@link java.sql.Types} constants) that
      * corresponds to the given JDBC type name.



Mime
View raw message