openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mik...@apache.org
Subject svn commit: r666334 - /openjpa/branches/1.0.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/OracleDictionary.java
Date Tue, 10 Jun 2008 21:31:58 GMT
Author: mikedd
Date: Tue Jun 10 14:31:58 2008
New Revision: 666334

URL: http://svn.apache.org/viewvc?rev=666334&view=rev
Log:
OPENJPA-632 porting svn rev 584463 to 1.0.x. 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/branches/1.0.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/OracleDictionary.java

Modified: openjpa/branches/1.0.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/OracleDictionary.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.0.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/OracleDictionary.java?rev=666334&r1=666333&r2=666334&view=diff
==============================================================================
--- openjpa/branches/1.0.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/OracleDictionary.java
(original)
+++ openjpa/branches/1.0.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/OracleDictionary.java
Tue Jun 10 14:31:58 2008
@@ -46,6 +46,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.J2DoPrivHelper;
@@ -357,7 +358,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)
@@ -368,7 +370,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);
@@ -377,17 +379,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;
         }
@@ -396,7 +399,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