openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mtyle...@apache.org
Subject svn commit: r1039879 - in /openjpa/trunk: openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/HSQLDictionary.java openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/generationtype/TestMultipleSchemaNames.java
Date Sun, 28 Nov 2010 13:18:41 GMT
Author: mtylenda
Date: Sun Nov 28 13:18:41 2010
New Revision: 1039879

URL: http://svn.apache.org/viewvc?rev=1039879&view=rev
Log:
OPENJPA-1863: Update HSQLDictionary for HSQLDB 2.0 - pagination and schema support.

Modified:
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/HSQLDictionary.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/generationtype/TestMultipleSchemaNames.java

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/HSQLDictionary.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/HSQLDictionary.java?rev=1039879&r1=1039878&r2=1039879&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/HSQLDictionary.java
(original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/HSQLDictionary.java
Sun Nov 28 13:18:41 2010
@@ -72,13 +72,9 @@ public class HSQLDictionary extends DBDi
         trimTrailingFunction = "RTRIM({0})";
         trimBothFunction = "LTRIM(RTRIM({0}))";
 
-        // HSQL 1.8.0 does support schema names in the table ("schema.table"),
-        // but doesn't support it for columns references ("schema.table.column")
-        useSchemaName = false;
         supportsSelectForUpdate = false;
         supportsSelectStartIndex = true;
         supportsSelectEndIndex = true;
-        rangePosition = RANGE_PRE_DISTINCT;
         supportsDeferredConstraints = false;
 
         doubleTypeName = "NUMERIC";
@@ -109,6 +105,10 @@ public class HSQLDictionary extends DBDi
         if (dbMajorVersion == 1) {
             blobTypeName = "VARBINARY";
             useGetObjectForBlobs = true;
+            rangePosition = RANGE_PRE_DISTINCT;
+            // HSQL 1.8.0 does support schema names in the table ("schema.table"),
+            // but doesn't support it for columns references ("schema.table.column")
+            useSchemaName = false;
         }
     }
 
@@ -310,6 +310,13 @@ public class HSQLDictionary extends DBDi
     @Override
     protected void appendSelectRange(SQLBuffer buf, long start, long end,
         boolean subselect) {
+        if (dbMajorVersion > 1) {
+            if (start != 0)
+                buf.append(" OFFSET ").appendValue(start);
+            if (end != Long.MAX_VALUE)
+                buf.append(" LIMIT ").appendValue(end - start);
+            return;
+        }
         // HSQL doesn't parameters in range
         buf.append(" LIMIT ").append(String.valueOf(start)).append(" ");
         if (end == Long.MAX_VALUE)

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/generationtype/TestMultipleSchemaNames.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/generationtype/TestMultipleSchemaNames.java?rev=1039879&r1=1039878&r2=1039879&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/generationtype/TestMultipleSchemaNames.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/generationtype/TestMultipleSchemaNames.java
Sun Nov 28 13:18:41 2010
@@ -27,6 +27,7 @@ import javax.persistence.Query;
 import org.apache.openjpa.jdbc.conf.JDBCConfiguration;
 import org.apache.openjpa.jdbc.sql.DBDictionary;
 import org.apache.openjpa.jdbc.sql.H2Dictionary;
+import org.apache.openjpa.jdbc.sql.HSQLDictionary;
 import org.apache.openjpa.jdbc.sql.MySQLDictionary;
 import org.apache.openjpa.jdbc.sql.OracleDictionary;
 import org.apache.openjpa.jdbc.sql.PostgresDictionary;
@@ -42,7 +43,7 @@ import org.apache.openjpa.persistence.te
 public class TestMultipleSchemaNames extends SingleEMFTestCase {
 
     public void setUp() {
-        // Need to skip tests on MySQL, Oracle and MS SQL Server
+        // Need to skip tests on some databases.
         // See createSchemas() comment at the bottom
         setUnsupportedDatabases(
                 MySQLDictionary.class,
@@ -415,9 +416,9 @@ public class TestMultipleSchemaNames ext
     }
 
     /**
-     * Create necessary schemas if running on PostgreSQL or H2 as they do
+     * Create necessary schemas if running on PostgreSQL, H2, solidDB or HSQLDB as they do
      * not create them automatically.
-     * Oracle, MySQL and MSSQL also don't create schemas automatically but
+     * Oracle, MySQL, MSSQL and Sybase also don't create schemas automatically but
      * we give up as they treat schemas in special ways.
      */
     private void createSchemas() {
@@ -425,7 +426,7 @@ public class TestMultipleSchemaNames ext
         DBDictionary dict = ((JDBCConfiguration) tempEmf.getConfiguration()).getDBDictionaryInstance();
         
         if (!(dict instanceof PostgresDictionary || dict instanceof H2Dictionary || 
-            dict instanceof SolidDBDictionary)) {
+            dict instanceof SolidDBDictionary || dict instanceof HSQLDictionary)) {
             closeEMF(tempEmf);
             return;
         }



Mime
View raw message