openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fa...@apache.org
Subject svn commit: r658544 - in /openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc: kernel/exps/Distinct.java sql/InformixDictionary.java
Date Wed, 21 May 2008 03:23:18 GMT
Author: fancy
Date: Tue May 20 20:23:18 2008
New Revision: 658544

URL: http://svn.apache.org/viewvc?rev=658544&view=rev
Log:
OPENJPA-606 InformixDictionary default property setting incorrectly set. Also fixed SQL problems
as described in the issue.

Modified:
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Distinct.java
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/InformixDictionary.java

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Distinct.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Distinct.java?rev=658544&r1=658543&r2=658544&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Distinct.java
(original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Distinct.java
Tue May 20 20:23:18 2008
@@ -18,6 +18,7 @@
  */
 package org.apache.openjpa.jdbc.kernel.exps;
 
+import org.apache.openjpa.jdbc.sql.SQLBuffer;
 import org.apache.openjpa.jdbc.sql.Select;
 
 /**
@@ -40,4 +41,18 @@
     protected String getOperator() {
         return "DISTINCT";
     }
+    
+
+    public void appendTo(Select sel, ExpContext ctx, ExpState state, 
+        SQLBuffer sql, int index) {
+        if (sel.getConfiguration().getDBDictionaryInstance().platform.indexOf(
+            "Informix") > -1) {
+            sql.append(getOperator());
+            sql.append(" ");
+            getValue().appendTo(sel, ctx, state, sql, 0);
+            sql.addCastForParam(getOperator(), getValue());
+        }
+        else
+            super.appendTo(sel, ctx, state, sql, index);
+    }
 }

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/InformixDictionary.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/InformixDictionary.java?rev=658544&r1=658543&r2=658544&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/InformixDictionary.java
(original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/InformixDictionary.java
Tue May 20 20:23:18 2008
@@ -28,12 +28,14 @@
 import java.util.Arrays;
 import java.util.Collection;
 
+import org.apache.openjpa.jdbc.kernel.exps.FilterValue;
 import org.apache.openjpa.jdbc.schema.Column;
 import org.apache.openjpa.jdbc.schema.ForeignKey;
 import org.apache.openjpa.jdbc.schema.Index;
 import org.apache.openjpa.jdbc.schema.PrimaryKey;
 import org.apache.openjpa.jdbc.schema.Table;
 import org.apache.openjpa.lib.util.ReferenceHashSet;
+import org.apache.openjpa.util.UnsupportedException;
 
 /**
  * Dictionary for Informix database. Notable features:
@@ -91,11 +93,6 @@
         supportsDeferredConstraints = false;
         constraintNameMode = CONS_NAME_AFTER;
 
-        maxTableNameLength = 18;
-        maxColumnNameLength = 18;
-        maxIndexNameLength = 18;
-        maxConstraintNameLength = 18;
-
         // informix supports "CLOB" type, but any attempt to insert
         // into them raises: "java.sql.SQLException: Can't convert fromnull"
         useGetStringForClobs = true;
@@ -109,7 +106,7 @@
         doubleTypeName = "NUMERIC(32,20)";
         dateTypeName = "DATE";
         timeTypeName = "DATETIME HOUR TO SECOND";
-        timestampTypeName = "DATETIME YEAR TO SECOND";
+        timestampTypeName = "DATETIME YEAR TO FRACTION(3)";
         doubleTypeName = "NUMERIC(32,20)";
         floatTypeName = "REAL";
         bigintTypeName = "NUMERIC(32,0)";
@@ -133,7 +130,17 @@
         // Informix doesn't support aliases in deletes if the table has an index
         allowsAliasInBulkClause = false;
         
-        supportsSubselect = false;
+        supportsTimestampNanos = false;
+
+        // Informix doesn't understand "X CROSS JOIN Y", but it does understand
+        // the equivalent "X JOIN Y ON 1 = 1"
+        crossJoinClause = "JOIN";
+        requiresConditionForCrossJoin = true;
+
+        concatenateFunction = "CONCAT({0},{1})";
+        nextSequenceQuery = "SELECT {0}.NEXTVAL FROM SYSTABLES WHERE TABID=1";
+        supportsCorrelatedSubselect = false;
+        swapSchemaAndCatalog = false;
     }
 
     public void connectedConfiguration(Connection conn)
@@ -190,7 +197,7 @@
         throws SQLException {
         // informix actually requires that a boolean be set: it cannot
         // handle a numeric argument
-        stmnt.setBoolean(idx, val);
+        stmnt.setString(idx, val ? "t" : "f");
     }
 
     public String[] getCreateTableSQL(Table table) {
@@ -256,4 +263,9 @@
             }
         return conn;
     }
+
+    public void indexOf(SQLBuffer buf, FilterValue str, FilterValue find,
+            FilterValue start) {
+        throw new UnsupportedException();
+    }
 }



Mime
View raw message