Author: tv
Date: Thu Jul 6 11:56:45 2006
New Revision: 419658
URL: http://svn.apache.org/viewvc?rev=419658&view=rev
Log:
Moved limit and offset generation to the adapters
Removed:
db/torque/runtime/trunk/src/java/org/apache/torque/util/LimitHelper.java
Modified:
db/torque/runtime/trunk/src/java/org/apache/torque/util/SQLBuilder.java
Modified:
db/torque/runtime/trunk/src/java/org/apache/torque/util/SQLBuilder.java
URL:
http://svn.apache.org/viewvc/db/torque/runtime/trunk/src/java/org/apache/torque/util/SQLBuilder.java?rev=419658&r1=419657&r2=419658&view=diff
==============================================================================
--- db/torque/runtime/trunk/src/java/org/apache/torque/util/SQLBuilder.java
(original)
+++ db/torque/runtime/trunk/src/java/org/apache/torque/util/SQLBuilder.java Thu
Jul 6 11:56:45 2006
@@ -287,7 +287,7 @@
processGroupBy(crit, query);
processHaving(crit, query);
processOrderBy(db, dbMap, crit, query);
- LimitHelper.buildLimit(crit, query);
+ processLimits(crit, query);
if (log.isDebugEnabled())
{
@@ -565,6 +565,28 @@
{
//String groupByString = null;
query.setHaving(having.toString());
+ }
+ }
+
+ /**
+ * adds a Limit clause to the query if supported by the database
+ * @param criteria the criteria from which the Limit and Offset values
+ * are taken
+ * @param query the query to which the Limit clause should be added
+ * @throws TorqueException if the Database adapter cannot be obtained
+ */
+ private static final void processLimits(
+ final Criteria crit,
+ final Query query)
+ throws TorqueException
+ {
+ int limit = crit.getLimit();
+ int offset = crit.getOffset();
+
+ if (offset > 0 || limit >= 0)
+ {
+ DB db = Torque.getDB(crit.getDbName());
+ db.generateLimits(query, offset, limit);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]