db-ddlutils-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject svn commit: r406085 - in /db/ddlutils/trunk/src: java/org/apache/ddlutils/platform/postgresql/PostgreSqlModelReader.java java/org/apache/ddlutils/platform/postgresql/PostgreSqlPlatform.java test/org/apache/ddlutils/dynabean/TestDynaSqlQueries.java
Date Sat, 13 May 2006 12:33:50 GMT
Author: tomdz
Date: Sat May 13 05:33:48 2006
New Revision: 406085

URL: http://svn.apache.org/viewcvs?rev=406085&view=rev
Log:
Fixed postgresql platform, esp. BYTEA and TEXT handling
Fixed query tests

Modified:
    db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/postgresql/PostgreSqlModelReader.java
    db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/postgresql/PostgreSqlPlatform.java
    db/ddlutils/trunk/src/test/org/apache/ddlutils/dynabean/TestDynaSqlQueries.java

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/postgresql/PostgreSqlModelReader.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/postgresql/PostgreSqlModelReader.java?rev=406085&r1=406084&r2=406085&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/postgresql/PostgreSqlModelReader.java
(original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/postgresql/PostgreSqlModelReader.java
Sat May 13 05:33:48 2006
@@ -103,13 +103,15 @@
             {
                 column.setSize(null);
                 // PostgreSQL reports BYTEA and TEXT as BINARY(-1) and VARCHAR(-1) respectively
+                // Since we cannot currently use the Blob/Clob interface with BYTEA, we instead
+                // map them to LONGVARBINARY/LONGVARCHAR
                 if (column.getTypeCode() == Types.BINARY)
                 {
-                    column.setTypeCode(Types.BLOB);
+                    column.setTypeCode(Types.LONGVARBINARY);
                 }
                 else if (column.getTypeCode() == Types.VARCHAR)
                 {
-                    column.setTypeCode(Types.CLOB);
+                    column.setTypeCode(Types.LONGVARCHAR);
                 }
             }
         }
@@ -139,6 +141,7 @@
                         break;
                     case Types.CHAR:
                     case Types.VARCHAR:
+                    case Types.LONGVARCHAR:
                     case Types.DATE:
                     case Types.TIME:
                     case Types.TIMESTAMP:

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/postgresql/PostgreSqlPlatform.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/postgresql/PostgreSqlPlatform.java?rev=406085&r1=406084&r2=406085&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/postgresql/PostgreSqlPlatform.java
(original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/postgresql/PostgreSqlPlatform.java
Sat May 13 05:33:48 2006
@@ -61,29 +61,33 @@
         info.setForeignKeysEmbedded(false);
         info.setIndicesEmbedded(false);
 
-        info.addNativeTypeMapping(Types.ARRAY,         "BYTEA",            Types.BINARY);
-        info.addNativeTypeMapping(Types.BINARY,        "BYTEA",            Types.BINARY);
+        info.addNativeTypeMapping(Types.ARRAY,         "BYTEA",            Types.LONGVARBINARY);
+        info.addNativeTypeMapping(Types.BINARY,        "BYTEA",            Types.LONGVARBINARY);
         info.addNativeTypeMapping(Types.BIT,           "BOOLEAN");
-        info.addNativeTypeMapping(Types.BLOB,          "BYTEA",            Types.BINARY);
-        info.addNativeTypeMapping(Types.CLOB,          "TEXT",             Types.VARCHAR);
+        info.addNativeTypeMapping(Types.BLOB,          "BYTEA",            Types.LONGVARBINARY);
+        info.addNativeTypeMapping(Types.CLOB,          "TEXT",             Types.LONGVARCHAR);
         info.addNativeTypeMapping(Types.DECIMAL,       "NUMERIC",          Types.NUMERIC);
-        info.addNativeTypeMapping(Types.DISTINCT,      "BYTEA",            Types.BINARY);
+        info.addNativeTypeMapping(Types.DISTINCT,      "BYTEA",            Types.LONGVARBINARY);
         info.addNativeTypeMapping(Types.DOUBLE,        "DOUBLE PRECISION");
         info.addNativeTypeMapping(Types.FLOAT,         "DOUBLE PRECISION", Types.DOUBLE);
-        info.addNativeTypeMapping(Types.JAVA_OBJECT,   "BYTEA",            Types.BINARY);
-        info.addNativeTypeMapping(Types.LONGVARBINARY, "BYTEA",            Types.BINARY);
-        info.addNativeTypeMapping(Types.LONGVARCHAR,   "TEXT",             Types.VARCHAR);
-        info.addNativeTypeMapping(Types.NULL,          "BYTEA",            Types.BINARY);
-        info.addNativeTypeMapping(Types.OTHER,         "BYTEA",            Types.BINARY);
-        info.addNativeTypeMapping(Types.REF,           "BYTEA",            Types.BINARY);
-        info.addNativeTypeMapping(Types.STRUCT,        "BYTEA",            Types.BINARY);
+        info.addNativeTypeMapping(Types.JAVA_OBJECT,   "BYTEA",            Types.LONGVARBINARY);
+        info.addNativeTypeMapping(Types.LONGVARBINARY, "BYTEA");
+        info.addNativeTypeMapping(Types.LONGVARCHAR,   "TEXT",             Types.LONGVARCHAR);
+        info.addNativeTypeMapping(Types.NULL,          "BYTEA",            Types.LONGVARBINARY);
+        info.addNativeTypeMapping(Types.OTHER,         "BYTEA",            Types.LONGVARBINARY);
+        info.addNativeTypeMapping(Types.REF,           "BYTEA",            Types.LONGVARBINARY);
+        info.addNativeTypeMapping(Types.STRUCT,        "BYTEA",            Types.LONGVARBINARY);
         info.addNativeTypeMapping(Types.TINYINT,       "SMALLINT",         Types.SMALLINT);
-        info.addNativeTypeMapping(Types.VARBINARY,     "BYTEA",            Types.BINARY);
+        info.addNativeTypeMapping(Types.VARBINARY,     "BYTEA",            Types.LONGVARBINARY);
         info.addNativeTypeMapping("BOOLEAN",  "BOOLEAN", "BIT");
-        info.addNativeTypeMapping("DATALINK", "BYTEA",   "BINARY");
+        info.addNativeTypeMapping("DATALINK", "BYTEA",   "LONGVARBINARY");
 
-        // no support for specifying the size for these types
-        info.setHasSize(Types.BINARY, false);
+        info.setDefaultSize(Types.CHAR,    254);
+        info.setDefaultSize(Types.VARCHAR, 254);
+
+        // no support for specifying the size for these types (because they are mapped
+        // to BYTEA which back-maps to BLOB)
+        info.setHasSize(Types.BINARY,    false);
         info.setHasSize(Types.VARBINARY, false);
 
         setSqlBuilder(new PostgreSqlBuilder(this));

Modified: db/ddlutils/trunk/src/test/org/apache/ddlutils/dynabean/TestDynaSqlQueries.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/test/org/apache/ddlutils/dynabean/TestDynaSqlQueries.java?rev=406085&r1=406084&r2=406085&view=diff
==============================================================================
--- db/ddlutils/trunk/src/test/org/apache/ddlutils/dynabean/TestDynaSqlQueries.java (original)
+++ db/ddlutils/trunk/src/test/org/apache/ddlutils/dynabean/TestDynaSqlQueries.java Sat May
13 05:33:48 2006
@@ -31,6 +31,15 @@
 public class TestDynaSqlQueries extends TestDatabaseWriterBase
 {
     /**
+     * {@inheritDoc}
+     */
+    protected void setUp() throws Exception
+    {
+        super.setUp();
+        getPlatform().setDelimitedIdentifierModeOn(false);
+    }
+
+    /**
      * Tests a simple SELECT query.
      */
     public void testSimpleQuery() throws Exception



Mime
View raw message