db-ddlutils-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject svn commit: r279413 - in /db/ddlutils/trunk/src: java/org/apache/ddlutils/ java/org/apache/ddlutils/builder/ java/org/apache/ddlutils/model/ java/org/apache/ddlutils/platform/ test/org/apache/ddlutils/
Date Wed, 07 Sep 2005 20:15:41 GMT
Author: tomdz
Date: Wed Sep  7 13:15:20 2005
New Revision: 279413

URL: http://svn.apache.org/viewcvs?rev=279413&view=rev
Log:
Fixed bug where a size info was written for column types that don't support it
Added ability to specify in the platform info for specific databases for which jdbc types
the corresponding native type

* has a null default value
* has a size specification
* has precision and scale specification

Added:
    db/ddlutils/trunk/src/test/org/apache/ddlutils/RunAllTests.java
Modified:
    db/ddlutils/trunk/src/java/org/apache/ddlutils/PlatformInfo.java
    db/ddlutils/trunk/src/java/org/apache/ddlutils/builder/CloudscapeBuilder.java
    db/ddlutils/trunk/src/java/org/apache/ddlutils/builder/Db2Builder.java
    db/ddlutils/trunk/src/java/org/apache/ddlutils/builder/InterbaseBuilder.java
    db/ddlutils/trunk/src/java/org/apache/ddlutils/builder/MySqlBuilder.java
    db/ddlutils/trunk/src/java/org/apache/ddlutils/builder/OracleBuilder.java
    db/ddlutils/trunk/src/java/org/apache/ddlutils/builder/PostgreSqlBuilder.java
    db/ddlutils/trunk/src/java/org/apache/ddlutils/builder/SapDbBuilder.java
    db/ddlutils/trunk/src/java/org/apache/ddlutils/builder/SqlBuilder.java
    db/ddlutils/trunk/src/java/org/apache/ddlutils/model/TypeMap.java
    db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/PostgreSqlPlatform.java
    db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/SapDbPlatform.java
    db/ddlutils/trunk/src/test/org/apache/ddlutils/TestPlatformBase.java

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/PlatformInfo.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/PlatformInfo.java?rev=279413&r1=279412&r2=279413&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/PlatformInfo.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/PlatformInfo.java Wed Sep  7 13:15:20 2005
@@ -3,6 +3,7 @@
 import java.lang.reflect.Field;
 import java.sql.Types;
 import java.util.HashMap;
+import java.util.HashSet;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -58,6 +59,38 @@
     /** Contains non-default mappings from jdbc to native types */
     private HashMap _nativeTypes = new HashMap();
 
+    /** Contains those JDBC types whose corresponding native types have a null value as the
default value */
+    private HashSet _typesWithNullDefault = new HashSet();
+
+    /** Contains those JDBC types whose corresponding native types are types that have a
size on this platform */
+    private HashSet _typesWithSize = new HashSet();
+
+    /** Contains those JDBC types whose corresponding native types are types that have precision
and scale on this platform */
+    private HashSet _typesWithPrecisionAndScale = new HashSet();
+
+    /**
+     * Creates a new platform info object.
+     */
+    public PlatformInfo()
+    {
+        _typesWithNullDefault.add(new Integer(Types.CHAR));
+        _typesWithNullDefault.add(new Integer(Types.VARCHAR));
+        _typesWithNullDefault.add(new Integer(Types.LONGVARCHAR));
+        _typesWithNullDefault.add(new Integer(Types.CLOB));
+        _typesWithNullDefault.add(new Integer(Types.BINARY));
+        _typesWithNullDefault.add(new Integer(Types.VARBINARY));
+        _typesWithNullDefault.add(new Integer(Types.LONGVARBINARY));
+        _typesWithNullDefault.add(new Integer(Types.BLOB));
+
+        _typesWithSize.add(new Integer(Types.CHAR));
+        _typesWithSize.add(new Integer(Types.VARCHAR));
+        _typesWithSize.add(new Integer(Types.BINARY));
+        _typesWithSize.add(new Integer(Types.VARBINARY));
+
+        _typesWithPrecisionAndScale.add(new Integer(Types.DECIMAL));
+        _typesWithPrecisionAndScale.add(new Integer(Types.NUMERIC));
+    }
+
     /**
      * Determines whether a NULL needs to be explicitly stated when the column
      * has no specified default value. Default is false.
@@ -382,5 +415,100 @@
     public String getNativeType(int typeCode)
     {
         return (String)_nativeTypes.get(new Integer(typeCode));
+    }
+
+    /**
+     * Specifies whether the native type for the given sql type code (one of the
+     * {@link java.sql.Types} constants) has a null default value on this platform.
+     * 
+     * @param sqlTypeCode    The sql type code
+     * @param hasNullDefault <code>true</code> if the native type has a null
default value
+     */
+    public void setHasNullDefault(int sqlTypeCode, boolean hasNullDefault)
+    {
+        if (hasNullDefault)
+        {
+            _typesWithNullDefault.add(new Integer(sqlTypeCode));
+        }
+        else
+        {
+            _typesWithNullDefault.remove(new Integer(sqlTypeCode));
+        }
+    }
+
+    /**
+     * Determines whether the native type for the given sql type code (one of the
+     * {@link java.sql.Types} constants) has a null default value on this platform.
+     * 
+     * @param sqlTypeCode The sql type code
+     * @return <code>true</code> if the native type has a null default value
+     */
+    public boolean hasNullDefault(int sqlTypeCode)
+    {
+        return _typesWithNullDefault.contains(new Integer(sqlTypeCode));
+    }
+
+    /**
+     * Specifies whether the native type for the given sql type code (one of the
+     * {@link java.sql.Types} constants) has a size specification on this platform.
+     * 
+     * @param sqlTypeCode The sql type code
+     * @param hasSize     <code>true</code> if the native type has a size specification
+     */
+    public void setHasSize(int sqlTypeCode, boolean hasSize)
+    {
+        if (hasSize)
+        {
+            _typesWithSize.add(new Integer(sqlTypeCode));
+        }
+        else
+        {
+            _typesWithSize.remove(new Integer(sqlTypeCode));
+        }
+    }
+
+    /**
+     * Determines whether the native type for the given sql type code (one of the
+     * {@link java.sql.Types} constants) has a size specification on this platform.
+     * 
+     * @param sqlTypeCode The sql type code
+     * @return <code>true</code> if the native type has a size specification
+     */
+    public boolean hasSize(int sqlTypeCode)
+    {
+        return _typesWithSize.contains(new Integer(sqlTypeCode));
+    }
+
+    /**
+     * Specifies whether the native type for the given sql type code (one of the
+     * {@link java.sql.Types} constants) has precision and scale specifications on
+     * this platform.
+     * 
+     * @param sqlTypeCode          The sql type code
+     * @param hasPrecisionAndScale <code>true</code> if the native type has precision
and scale specifications
+     */
+    public void setHasPrecisionAndScale(int sqlTypeCode, boolean hasPrecisionAndScale)
+    {
+        if (hasPrecisionAndScale)
+        {
+            _typesWithPrecisionAndScale.add(new Integer(sqlTypeCode));
+        }
+        else
+        {
+            _typesWithPrecisionAndScale.remove(new Integer(sqlTypeCode));
+        }
+    }
+
+    /**
+     * Determines whether the native type for the given sql type code (one of the
+     * {@link java.sql.Types} constants) has precision and scale specifications on
+     * this platform.
+     * 
+     * @param sqlTypeCode The sql type code
+     * @return <code>true</code> if the native type has precision and scale specifications
+     */
+    public boolean hasPrecisionAndScale(int sqlTypeCode)
+    {
+        return _typesWithPrecisionAndScale.contains(new Integer(sqlTypeCode));
     }
 }

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/builder/CloudscapeBuilder.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/builder/CloudscapeBuilder.java?rev=279413&r1=279412&r2=279413&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/builder/CloudscapeBuilder.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/builder/CloudscapeBuilder.java Wed Sep
 7 13:15:20 2005
@@ -54,13 +54,13 @@
                 
                 sqlType.append(getNativeType(column));
                 sqlType.append(" (");
-                if (column.getSize() != null)
+                if (column.getSize() == null)
                 {
-                    sqlType.append(column.getSize());
+                    sqlType.append("254");
                 }
                 else
                 {
-                    sqlType.append("254");
+                    sqlType.append(column.getSize());
                 }
                 sqlType.append(") FOR BIT DATA");
                 return sqlType.toString();

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/builder/Db2Builder.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/builder/Db2Builder.java?rev=279413&r1=279412&r2=279413&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/builder/Db2Builder.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/builder/Db2Builder.java Wed Sep  7 13:15:20
2005
@@ -55,13 +55,13 @@
 
                 sqlType.append(getNativeType(column));
                 sqlType.append(" (");
-                if (column.getSize() != null)
+                if (column.getSize() == null)
                 {
-                    sqlType.append(column.getSize());
+                    sqlType.append("254");
                 }
                 else
                 {
-                    sqlType.append("254");
+                    sqlType.append(column.getSize());
                 }
                 sqlType.append(") FOR BIT DATA");
                 return sqlType.toString();

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/builder/InterbaseBuilder.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/builder/InterbaseBuilder.java?rev=279413&r1=279412&r2=279413&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/builder/InterbaseBuilder.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/builder/InterbaseBuilder.java Wed Sep 
7 13:15:20 2005
@@ -118,20 +118,9 @@
     {
         switch (column.getTypeCode())
         {
-            // we need to always specify a size for these types
             case Types.BINARY:
             case Types.VARBINARY:
-                StringBuffer sqlType = new StringBuffer();
-
-                sqlType.append(getNativeType(column));
-                if (column.getSize() != null)
-                {
-                    sqlType.append(" (");
-                    sqlType.append(column.getSize());
-                    sqlType.append(")");
-                }
-                sqlType.append(" CHARACTER SET OCTETS");
-                return sqlType.toString();
+                return super.getSqlType(column) + " CHARACTER SET OCTETS";
             default:
                 return super.getSqlType(column);
         }

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/builder/MySqlBuilder.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/builder/MySqlBuilder.java?rev=279413&r1=279412&r2=279413&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/builder/MySqlBuilder.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/builder/MySqlBuilder.java Wed Sep  7 13:15:20
2005
@@ -66,13 +66,13 @@
 
                 sqlType.append(getNativeType(column));
                 sqlType.append("(");
-                if (column.getSize() != null)
+                if (column.getSize() == null)
                 {
-                    sqlType.append(column.getSize());
+                    sqlType.append("254");
                 }
                 else
                 {
-                    sqlType.append("254");
+                    sqlType.append(column.getSize());
                 }
                 sqlType.append(") BINARY");
                 return sqlType.toString();

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/builder/OracleBuilder.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/builder/OracleBuilder.java?rev=279413&r1=279412&r2=279413&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/builder/OracleBuilder.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/builder/OracleBuilder.java Wed Sep  7 13:15:20
2005
@@ -77,13 +77,20 @@
             // we need to always specify a size for these types
             case Types.BINARY:
             case Types.VARCHAR:
-                String result = super.getSqlType(column);
+                StringBuffer sqlType = new StringBuffer();
 
+                sqlType.append(getNativeType(column));
+                sqlType.append("(");
                 if (column.getSize() == null)
                 {
-                    result += "(254)";
+                    sqlType.append("254");
                 }
-                return result;
+                else
+                {
+                    sqlType.append(column.getSize());
+                }
+                sqlType.append(")");
+                return sqlType.toString();
             default:
                 return super.getSqlType(column);
         }

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/builder/PostgreSqlBuilder.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/builder/PostgreSqlBuilder.java?rev=279413&r1=279412&r2=279413&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/builder/PostgreSqlBuilder.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/builder/PostgreSqlBuilder.java Wed Sep
 7 13:15:20 2005
@@ -17,7 +17,6 @@
  */
 
 import java.io.IOException;
-import java.sql.Types;
 
 import org.apache.ddlutils.PlatformInfo;
 import org.apache.ddlutils.model.Column;
@@ -69,22 +68,6 @@
             }
         }
         super.createTable(database, table);
-    }
-
-    /* (non-Javadoc)
-     * @see org.apache.ddlutils.builder.SqlBuilder#getSqlType(org.apache.ddlutils.model.Column)
-     */
-    protected String getSqlType(Column column)
-    {
-        switch (column.getTypeCode())
-        {
-            // no support for specifying the size for these types:
-            case Types.BINARY:
-            case Types.VARBINARY:
-                return getNativeType(column);
-            default:
-                return super.getSqlType(column);
-        }
     }
 
     /**

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/builder/SapDbBuilder.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/builder/SapDbBuilder.java?rev=279413&r1=279412&r2=279413&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/builder/SapDbBuilder.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/builder/SapDbBuilder.java Wed Sep  7 13:15:20
2005
@@ -17,10 +17,8 @@
  */
 
 import java.io.IOException;
-import java.sql.Types;
 
 import org.apache.ddlutils.PlatformInfo;
-import org.apache.ddlutils.model.Column;
 import org.apache.ddlutils.model.Table;
 
 /**
@@ -40,22 +38,6 @@
     public SapDbBuilder(PlatformInfo info)
     {
         super(info);
-    }
-
-    /* (non-Javadoc)
-     * @see org.apache.ddlutils.builder.SqlBuilder#getSqlType(org.apache.ddlutils.model.Column)
-     */
-    protected String getSqlType(Column column)
-    {
-        switch (column.getTypeCode())
-        {
-            // no support for specifying the size for these types:
-            case Types.BINARY:
-            case Types.VARBINARY:
-                return getNativeType(column);
-            default:
-                return super.getSqlType(column);
-        }
     }
 
     /* (non-Javadoc)

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/builder/SqlBuilder.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/builder/SqlBuilder.java?rev=279413&r1=279412&r2=279413&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/builder/SqlBuilder.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/builder/SqlBuilder.java Wed Sep  7 13:15:20
2005
@@ -36,7 +36,6 @@
 import org.apache.ddlutils.model.Index;
 import org.apache.ddlutils.model.IndexColumn;
 import org.apache.ddlutils.model.Table;
-import org.apache.ddlutils.model.TypeMap;
 
 /**
  * This class is a collection of Strategy methods for creating the DDL required to create
and drop 
@@ -964,7 +963,7 @@
             writeColumnNotNullableStmt();
         }
         else if (getPlatformInfo().isRequiringNullAsDefaultValue() &&
-                 (TypeMap.isTextType(column.getTypeCode()) || TypeMap.isBinaryType(column.getTypeCode())))
+                 getPlatformInfo().hasNullDefault(column.getTypeCode()))
         {
             print(" ");
             writeColumnNullableStmt();
@@ -1018,14 +1017,20 @@
 
         if (column.getSize() != null)
         {
-            sqlType.append("(");
-            sqlType.append(column.getSize());
-            if (TypeMap.typeHasScaleAndPrecision(column.getType()))
+            if (getPlatformInfo().hasSize(column.getTypeCode()))
             {
+                sqlType.append("(");
+                sqlType.append(column.getSize());
+                sqlType.append(")");
+            }
+            else if (getPlatformInfo().hasPrecisionAndScale(column.getTypeCode()))
+            {
+                sqlType.append("(");
+                sqlType.append(column.getSize());
                 sqlType.append(",");
                 sqlType.append(column.getScale());
+                sqlType.append(")");
             }
-            sqlType.append(")");
         }
         return sqlType.toString();
     }

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/model/TypeMap.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/model/TypeMap.java?rev=279413&r1=279412&r2=279413&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 Wed Sep  7 13:15:20
2005
@@ -63,19 +63,6 @@
     public static final String VARBINARY     = "VARBINARY";
     public static final String VARCHAR       = "VARCHAR";
 
-    private static final String[] TEXT_TYPES =
-    {
-        CHAR, VARCHAR, LONGVARCHAR, CLOB
-    };
-    private static final String[] BINARY_TYPES =
-    {
-        BINARY, VARBINARY, LONGVARBINARY, BLOB
-    };
-    private static final String[] DECIMAL_TYPES =
-    {
-        NUMERIC, DECIMAL
-    };
-
     private static Hashtable sqlTypeNameToTypeID = new Hashtable();
     private static Hashtable typeIdToSqlTypeName = new Hashtable();
 
@@ -142,94 +129,6 @@
 
         return answer == null ? OTHER : answer;
     }
-
-    /**
-     * Determines whether the indicated type is a textual type.
-     *
-     * @param type The code of type to check (as defined by {@link java.sql.Types}
-     */
-    public static final boolean isTextType(int type)
-    {
-        return isTextType(getJdbcTypeName(type));
-    }
-
-    /**
-     * Determines whether the indicated type is a textual type.
-     *
-     * @param type The type to check
-     */
-    public static final boolean isTextType(String type)
-    {
-        for (int i = 0; i < TEXT_TYPES.length; i++)
-        {
-            if (type.equalsIgnoreCase(TEXT_TYPES[i]))
-            {
-                return true;
-            }
-        }
-
-        // If we get this far, there were no matches.
-        return false;
-    }
-
-    /**
-     * Determines whether the indicated type is a binary type.
-     *
-     * @param type The code of type to check (as defined by {@link java.sql.Types}
-     */
-    public static final boolean isBinaryType(int type)
-    {
-        return isBinaryType(getJdbcTypeName(type));
-    }
-
-    /**
-     * Determines whether the indicated type is a binary type.
-     *
-     * @param type The type to check
-     */
-    public static final boolean isBinaryType(String type)
-    {
-        for (int i = 0; i < BINARY_TYPES.length; i++)
-        {
-            if (type.equalsIgnoreCase(BINARY_TYPES[i]))
-            {
-                return true;
-            }
-        }
-
-        // If we get this far, there were no matches.
-        return false;
-    }
-
-    /**
-     * Returns true if values for the type need have size and scale measurements
-     *
-     * @param type The type to check.
-     */
-    public static final boolean typeHasScaleAndPrecision(int type)
-    {
-        return typeHasScaleAndPrecision(getJdbcTypeName(type));
-    }
-
-    /**
-     * Returns true if values for the type need have size and scale measurements
-     *
-     * @param type The type to check.
-     */
-    public static final boolean typeHasScaleAndPrecision(String type)
-    {
-        for (int i = 0; i < DECIMAL_TYPES.length; i++)
-        {
-            if (type.equalsIgnoreCase(DECIMAL_TYPES[i]))
-            {
-                return true;
-            }
-        }
-
-        // If we get this far, there were no matches.
-        return false;
-    }
-
 
     /**
      * Registers the fact that the given Integer SQL ID maps to the given SQL name

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/PostgreSqlPlatform.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/PostgreSqlPlatform.java?rev=279413&r1=279412&r2=279413&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/PostgreSqlPlatform.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/PostgreSqlPlatform.java Wed Sep
 7 13:15:20 2005
@@ -75,6 +75,10 @@
         info.addNativeTypeMapping(Types.VARBINARY,     "BYTEA");
         info.addNativeTypeMapping("DATALINK", "BYTEA");
 
+        // no support for specifying the size for these types
+        info.setHasSize(Types.BINARY, false);
+        info.setHasSize(Types.VARBINARY, false);
+
         setSqlBuilder(new PostgreSqlBuilder(info));
     }
 

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/SapDbPlatform.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/SapDbPlatform.java?rev=279413&r1=279412&r2=279413&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/SapDbPlatform.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/SapDbPlatform.java Wed Sep  7
13:15:20 2005
@@ -72,6 +72,10 @@
         info.addNativeTypeMapping(Types.VARBINARY,     "LONG BYTE");
         info.addNativeTypeMapping("DATALINK", "LONG BYTE");
 
+        // no support for specifying the size for these types
+        info.setHasSize(Types.BINARY, false);
+        info.setHasSize(Types.VARBINARY, false);
+
         setSqlBuilder(new SapDbBuilder(info));
     }
 

Added: db/ddlutils/trunk/src/test/org/apache/ddlutils/RunAllTests.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/test/org/apache/ddlutils/RunAllTests.java?rev=279413&view=auto
==============================================================================
--- db/ddlutils/trunk/src/test/org/apache/ddlutils/RunAllTests.java (added)
+++ db/ddlutils/trunk/src/test/org/apache/ddlutils/RunAllTests.java Wed Sep  7 13:15:20 2005
@@ -0,0 +1,77 @@
+package org.apache.ddlutils;
+
+import org.apache.ddlutils.builder.TestAxionPlatform;
+import org.apache.ddlutils.builder.TestCloudscapePlatform;
+import org.apache.ddlutils.builder.TestDB2Platform;
+import org.apache.ddlutils.builder.TestDerbyPlatform;
+import org.apache.ddlutils.builder.TestFirebirdPlatform;
+import org.apache.ddlutils.builder.TestHsqlDbPlatform;
+import org.apache.ddlutils.builder.TestInterbasePlatform;
+import org.apache.ddlutils.builder.TestMSSqlPlatform;
+import org.apache.ddlutils.builder.TestMaxDbPlatform;
+import org.apache.ddlutils.builder.TestMcKoiPlatform;
+import org.apache.ddlutils.builder.TestMySqlPlatform;
+import org.apache.ddlutils.builder.TestOracle8Platform;
+import org.apache.ddlutils.builder.TestOracle9Platform;
+import org.apache.ddlutils.builder.TestPostgresqlPlatform;
+import org.apache.ddlutils.builder.TestSapDbPlatform;
+import org.apache.ddlutils.builder.TestSybasePlatform;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+/**
+ * Helper class to run all DdlUtils tests.
+ */
+public class RunAllTests extends TestCase
+{
+    /**
+     * Creates a new instance.
+     * 
+     * @param name The name of the test case
+     */
+    public RunAllTests(String name)
+    {
+        super(name);
+    }
+
+    /**
+     * Runs the test cases on the commandline using the text ui.
+     * 
+     * @param args The invocation arguments
+     */
+    public static void main(String[] args)
+    {
+        junit.textui.TestRunner.run(suite());
+    }
+
+    /**
+     * Returns a test suite containing all test cases.
+     * 
+     * @return The test suite
+     */
+    public static Test suite()
+    {
+        TestSuite suite = new TestSuite("Ddlutils tests");
+
+        suite.addTestSuite(TestAxionPlatform.class);
+        suite.addTestSuite(TestCloudscapePlatform.class);
+        suite.addTestSuite(TestDB2Platform.class);
+        suite.addTestSuite(TestDerbyPlatform.class);
+        suite.addTestSuite(TestFirebirdPlatform.class);
+        suite.addTestSuite(TestHsqlDbPlatform.class);
+        suite.addTestSuite(TestInterbasePlatform.class);
+        suite.addTestSuite(TestMaxDbPlatform.class);
+        suite.addTestSuite(TestMcKoiPlatform.class);
+        suite.addTestSuite(TestMSSqlPlatform.class);
+        suite.addTestSuite(TestMySqlPlatform.class);
+        suite.addTestSuite(TestOracle8Platform.class);
+        suite.addTestSuite(TestOracle9Platform.class);
+        suite.addTestSuite(TestPostgresqlPlatform.class);
+        suite.addTestSuite(TestSapDbPlatform.class);
+        suite.addTestSuite(TestSybasePlatform.class);
+        
+        return suite;
+    }
+}

Modified: db/ddlutils/trunk/src/test/org/apache/ddlutils/TestPlatformBase.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/test/org/apache/ddlutils/TestPlatformBase.java?rev=279413&r1=279412&r2=279413&view=diff
==============================================================================
--- db/ddlutils/trunk/src/test/org/apache/ddlutils/TestPlatformBase.java (original)
+++ db/ddlutils/trunk/src/test/org/apache/ddlutils/TestPlatformBase.java Wed Sep  7 13:15:20
2005
@@ -47,7 +47,7 @@
         "    <column name=\"COL_CLOB\"            type=\"CLOB\"/>\n"+
         "    <column name=\"COL_DATALINK\"        type=\"DATALINK\"/>\n"+
         "    <column name=\"COL_DATE\"            type=\"DATE\"/>\n"+
-        "    <column name=\"COL_DECIMAL\"         type=\"DECIMAL\" scale=\"3\" size=\"15\"/>\n"+
+        "    <column name=\"COL_DECIMAL\"         type=\"DECIMAL\" size=\"15,3\"/>\n"+
         "    <column name=\"COL_DECIMAL_NOSCALE\" type=\"DECIMAL\" size=\"15\"/>\n"+
         "    <column name=\"COL_DISTINCT\"        type=\"DISTINCT\"/>\n"+
         "    <column name=\"COL_DOUBLE\"          type=\"DOUBLE\"/>\n"+
@@ -61,7 +61,7 @@
         "    <column name=\"COL_OTHER\"           type=\"OTHER\"/>\n"+
         "    <column name=\"COL_REAL\"            type=\"REAL\"/>\n"+
         "    <column name=\"COL_REF\"             type=\"REF\"/>\n"+
-        "    <column name=\"COL_SMALLINT\"        type=\"SMALLINT\"/>\n"+
+        "    <column name=\"COL_SMALLINT\"        type=\"SMALLINT\" size=\"5\"/>\n"+
         "    <column name=\"COL_STRUCT\"          type=\"STRUCT\"/>\n"+
         "    <column name=\"COL_TIME\"            type=\"TIME\"/>\n"+
         "    <column name=\"COL_TIMESTAMP\"       type=\"TIMESTAMP\"/>\n"+



Mime
View raw message