db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tfisc...@apache.org
Subject svn commit: r411597 - in /db/torque: runtime/trunk/src/java/org/apache/torque/util/LimitHelper.java site/trunk/xdocs/changes.xml
Date Sun, 04 Jun 2006 21:07:43 GMT
Author: tfischer
Date: Sun Jun  4 14:07:43 2006
New Revision: 411597

URL: http://svn.apache.org/viewvc?rev=411597&view=rev
Log:
Improved the performance of sybase limit using SET ROWCOUNT.
I could not test the patch but according to the sybase docs it looks ok.
Thanks to Martin Goulet for the patch.
Fixes TORQUE-25

Modified:
    db/torque/runtime/trunk/src/java/org/apache/torque/util/LimitHelper.java
    db/torque/site/trunk/xdocs/changes.xml

Modified: db/torque/runtime/trunk/src/java/org/apache/torque/util/LimitHelper.java
URL: http://svn.apache.org/viewvc/db/torque/runtime/trunk/src/java/org/apache/torque/util/LimitHelper.java?rev=411597&r1=411596&r2=411597&view=diff
==============================================================================
--- db/torque/runtime/trunk/src/java/org/apache/torque/util/LimitHelper.java (original)
+++ db/torque/runtime/trunk/src/java/org/apache/torque/util/LimitHelper.java Sun Jun  4 14:07:43
2006
@@ -69,6 +69,9 @@
             case DB.LIMIT_STYLE_DB2 :
                 LimitHelper.generateDB2Limits(query, offset, limit);
                 break;
+            case DB.LIMIT_STYLE_SYBASE :
+            	LimitHelper.generateSybaseLimits(query, offset, limit);
+            	break;
             default:
                 if (db.supportsNativeLimit())
                 {
@@ -112,6 +115,19 @@
         query.setPostLimit(null);
     }
 
+    /**
+     * Modify a query to add limit and offset values for Sybase.
+     *
+     * @param query The query to modify
+     * @param offset the offset Value
+     * @param limit the limit Value
+     */
+    private static final void generateSybaseLimits(Query query,
+            int offset, int limit)
+    {
+    	query.setRowcount(String.valueOf(limit+offset));
+    }
+    
     /**
      * Generate a LIMIT limit OFFSET offset clause if offset > 0
      * or an LIMIT limit clause if limit is > 0 and offset

Modified: db/torque/site/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/db/torque/site/trunk/xdocs/changes.xml?rev=411597&r1=411596&r2=411597&view=diff
==============================================================================
--- db/torque/site/trunk/xdocs/changes.xml (original)
+++ db/torque/site/trunk/xdocs/changes.xml Sun Jun  4 14:07:43 2006
@@ -29,6 +29,9 @@
 
   <release version="3.2.1-dev" date="in SVN">
   
+    <action type="add" dev="tfischer" issue="TORQUE-25" due-to="Martin Goulet">
+      Improved performance for sybase limit using SET ROWCOUNT.
+    </action>
     <action type="add" dev="tfischer" issue="TORQUE-23" due-to="Thoralf Rickert">
       Added methods for shallow copies into the generated objects.
     </action>



---------------------------------------------------------------------
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