openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mprud...@apache.org
Subject svn commit: r584463 - /openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/OracleDictionary.java
Date Sun, 14 Oct 2007 01:02:20 GMT
Author: mprudhom
Date: Sat Oct 13 18:02:19 2007
New Revision: 584463

URL: http://svn.apache.org/viewvc?rev=584463&view=rev
Log:
The overridden toSelect() signature in the OracleDictionary was no longer appropriate since
the DBDictionary.toSelect() change in revision #577972 (which fixed OPENJPA-378). This resulted
in the special Oracle range handing to no longer take place, resulting in setFirstResult()
and setMaxResults() effectively being ignored for Oracle.

Modified:
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/OracleDictionary.java

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/OracleDictionary.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/OracleDictionary.java?rev=584463&r1=584462&r2=584463&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/OracleDictionary.java
(original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/OracleDictionary.java
Sat Oct 13 18:02:19 2007
@@ -45,6 +45,7 @@
 import org.apache.openjpa.jdbc.schema.PrimaryKey;
 import org.apache.openjpa.jdbc.schema.Sequence;
 import org.apache.openjpa.jdbc.schema.Table;
+import org.apache.openjpa.jdbc.sql.Select;
 import org.apache.openjpa.lib.jdbc.DelegatingDatabaseMetaData;
 import org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement;
 import org.apache.openjpa.lib.util.Localizer;
@@ -353,7 +354,8 @@
     public SQLBuffer toSelect(SQLBuffer select, JDBCFetchConfiguration fetch,
         SQLBuffer tables, SQLBuffer where, SQLBuffer group,
         SQLBuffer having, SQLBuffer order,
-        boolean distinct, boolean forUpdate, long start, long end) {
+        boolean distinct, boolean forUpdate, long start, long end,
+        Select sel) {
         if (!_checkedUpdateBug) {
             ensureDriverVendor();
             if (forUpdate && _driverBehavior == BEHAVE_DATADIRECT31)
@@ -364,7 +366,7 @@
         // if no range, use standard select
         if (start == 0 && end == Long.MAX_VALUE)
             return super.toSelect(select, fetch, tables, where, group, having,
-                order, distinct, forUpdate, 0, Long.MAX_VALUE);
+                order, distinct, forUpdate, 0, Long.MAX_VALUE, sel);
 
         // if no skip, ordering, or distinct can use rownum directly
         SQLBuffer buf = new SQLBuffer(this);
@@ -373,17 +375,18 @@
                 buf.append(where).append(" AND ");
             buf.append("ROWNUM <= ").appendValue(end);
             return super.toSelect(select, fetch, tables, buf, group, having,
-                order, distinct, forUpdate, 0, Long.MAX_VALUE);
+                order, distinct, forUpdate, 0, Long.MAX_VALUE, sel);
         }
 
         // if there is ordering, skip, or distinct we have to use subselects
-        SQLBuffer sel = super.toSelect(select, fetch, tables, where,
-            group, having, order, distinct, forUpdate, 0, Long.MAX_VALUE);
+        SQLBuffer newsel = super.toSelect(select, fetch, tables, where,
+            group, having, order, distinct, forUpdate, 0, Long.MAX_VALUE,
+            sel);
 
         // if no skip, can use single nested subselect
         if (start == 0) {
             buf.append(getSelectOperation(fetch) + " * FROM (");
-            buf.append(sel);
+            buf.append(newsel);
             buf.append(") WHERE ROWNUM <= ").appendValue(end);
             return buf;
         }
@@ -392,7 +395,7 @@
         // where conditions on the rownum
         buf.append(getSelectOperation(fetch)
             + " * FROM (SELECT r.*, ROWNUM RNUM FROM (");
-        buf.append(sel);
+        buf.append(newsel);
         buf.append(") r");
         if (end != Long.MAX_VALUE)
             buf.append(" WHERE ROWNUM <= ").appendValue(end);



Mime
View raw message