db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tfisc...@apache.org
Subject svn commit: r1435864 - in /db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates: transformer/SchemaTypeHelper.java typemapping/SizedForBitDataSqlType.java typemapping/SqlType.java
Date Sun, 20 Jan 2013 15:11:38 GMT
Author: tfischer
Date: Sun Jan 20 15:11:37 2013
New Revision: 1435864

URL: http://svn.apache.org/viewvc?rev=1435864&view=rev
Log:
TORQUE-252 BINARY and VARBINARY Datatypes mapped incorrectly in Derby

Modified:
    db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/SchemaTypeHelper.java
    db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/typemapping/SizedForBitDataSqlType.java
    db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/typemapping/SqlType.java

Modified: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/SchemaTypeHelper.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/SchemaTypeHelper.java?rev=1435864&r1=1435863&r2=1435864&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/SchemaTypeHelper.java
(original)
+++ db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/SchemaTypeHelper.java
Sun Jan 20 15:11:37 2013
@@ -161,8 +161,11 @@ public final class SchemaTypeHelper
                 defaultValue = domainType.getDefaultValue();
             }
         }
-        SqlType result
-                = new SqlType(platformSqlType, size, scale, defaultValue);
+        SqlType result = platformSqlType.getNew(
+                platformSqlType.getSqlTypeName(),
+                size,
+                scale,
+                defaultValue);
         return result;
     }
 

Modified: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/typemapping/SizedForBitDataSqlType.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/typemapping/SizedForBitDataSqlType.java?rev=1435864&r1=1435863&r2=1435864&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/typemapping/SizedForBitDataSqlType.java
(original)
+++ db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/typemapping/SizedForBitDataSqlType.java
Sun Jan 20 15:11:37 2013
@@ -72,20 +72,58 @@ public class SizedForBitDataSqlType exte
     }
 
     /**
+     * @see SqlType#SqlType(String, String, string, String)
+     */
+    public SizedForBitDataSqlType(
+            String sqlType,
+            String size,
+            String scale,
+            String defaultValue)
+    {
+        super(sqlType, size, scale, defaultValue);
+    }
+
+    /**
      * Returns the size postfix for the base SQL Column type.
      *
      * @return "(size) FOR BIT DATA" or just " FOR BIT DATA" if size
      * is null.
      * @see org.apache.torque.SqlType.database.model.Domain#getSize()
      */
-    public String printSize()
+    @Override
+    public String printSize(String sizeSuffix)
     {
         String result = "";
         if (!StringUtils.isBlank(getSize()))
         {
-            result =  "(" + getSize() + ")";
+            result =  "(" + getSize() + sizeSuffix + ")";
         }
         result = result + " FOR BIT DATA";
         return result;
     }
+
+    /**
+     * Returns a new instance with the given sqlTypeName, size, scale
+     * and default value.
+     *
+     * @return a new instance with the given parameters.
+     */
+    @Override
+    public SqlType getNew(
+            String sqlTypeName,
+            String size,
+            String scale,
+            String defaultValue)
+    {
+        if (size == null)
+        {
+            size = "1";;
+        }
+        return new SizedForBitDataSqlType(
+                sqlTypeName,
+                size,
+                scale,
+                defaultValue);
+    }
+
 }

Modified: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/typemapping/SqlType.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/typemapping/SqlType.java?rev=1435864&r1=1435863&r2=1435864&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/typemapping/SqlType.java
(original)
+++ db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/typemapping/SqlType.java
Sun Jan 20 15:11:37 2013
@@ -68,7 +68,7 @@ public class SqlType
     /**
      * The SQL expression for the type name, or null if unknown.
      */
-    private String sqlTypeName;
+    private final String sqlTypeName;
 
     /**
      * Creates a new SqlType with the given SQL Type.
@@ -241,4 +241,19 @@ public class SqlType
             return "";
         }
     }
+
+    /**
+     * Returns a new instance with the given sqlTypeName, size, scale
+     * and default value.
+     *
+     * @return a new instance with the given parameters.
+     */
+    public SqlType getNew(
+            String sqlTypeName,
+            String size,
+            String scale,
+            String defaultValue)
+    {
+        return new SqlType(sqlTypeName, size, scale, defaultValue);
+    }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


Mime
View raw message