db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t.@apache.org
Subject svn commit: r419659 - in /db/torque/runtime/trunk/src/java/org/apache/torque/util: BasePeer.java LargeSelect.java
Date Thu, 06 Jul 2006 18:58:03 GMT
Author: tv
Date: Thu Jul  6 11:58:02 2006
New Revision: 419659

URL: http://svn.apache.org/viewvc?rev=419659&view=rev
Log:
Use the supportsNativeLimit() and supportsNativeOffset() methods
independently

Modified:
    db/torque/runtime/trunk/src/java/org/apache/torque/util/BasePeer.java
    db/torque/runtime/trunk/src/java/org/apache/torque/util/LargeSelect.java

Modified: db/torque/runtime/trunk/src/java/org/apache/torque/util/BasePeer.java
URL: http://svn.apache.org/viewvc/db/torque/runtime/trunk/src/java/org/apache/torque/util/BasePeer.java?rev=419659&r1=419658&r2=419659&view=diff
==============================================================================
--- db/torque/runtime/trunk/src/java/org/apache/torque/util/BasePeer.java (original)
+++ db/torque/runtime/trunk/src/java/org/apache/torque/util/BasePeer.java Thu Jul  6 11:58:02
2006
@@ -729,26 +729,14 @@
         throws TorqueException
     {
         Query query = createQuery(criteria);
-
-        if (query.hasLimit())
-        {
-            // We don't need Village to limit the Query
-            return executeQuery(query.toString(),
-                    0,
-                    -1,
-                    criteria.isSingleRecord(),
-                    con);
-        }
-        else
-        {
-            // There is no limit string registered
-            // with the query. Let Village decide.
-            return executeQuery(query.toString(),
-                    criteria.getOffset(),
-                    criteria.getLimit(),
-                    criteria.isSingleRecord(),
-                    con);
-        }
+        DB dbadapter = Torque.getDB(criteria.getDbName());
+        
+        // Call Village depending on the capabilities of the DB 
+        return executeQuery(query.toString(),
+                dbadapter.supportsNativeOffset() ? 0 : criteria.getOffset(),
+                dbadapter.supportsNativeLimit() ? -1 : criteria.getLimit(),
+                criteria.isSingleRecord(),
+                con);
     }
 
     /**

Modified: db/torque/runtime/trunk/src/java/org/apache/torque/util/LargeSelect.java
URL: http://svn.apache.org/viewvc/db/torque/runtime/trunk/src/java/org/apache/torque/util/LargeSelect.java?rev=419659&r1=419658&r2=419659&view=diff
==============================================================================
--- db/torque/runtime/trunk/src/java/org/apache/torque/util/LargeSelect.java (original)
+++ db/torque/runtime/trunk/src/java/org/apache/torque/util/LargeSelect.java Thu Jul  6 11:58:02
2006
@@ -32,7 +32,6 @@
 import org.apache.commons.logging.LogFactory;
 import org.apache.torque.Torque;
 import org.apache.torque.TorqueException;
-import org.apache.torque.adapter.DB;
 
 import com.workingdogs.village.DataSetException;
 import com.workingdogs.village.QueryDataSet;
@@ -675,8 +674,7 @@
         try
         {
             dbSupportsNativeLimit 
-                    = (Torque.getDB(dbName).getLimitStyle()
-                        != DB.LIMIT_STYLE_NONE);
+                    = (Torque.getDB(dbName).supportsNativeLimit());
         }
         catch (TorqueException e)
         {



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


Mime
View raw message