cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r709926 - /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/frontbase/FrontBaseSelectTranslator.java
Date Sun, 02 Nov 2008 20:57:17 GMT
Author: aadamchik
Date: Sun Nov  2 12:57:17 2008
New Revision: 709926

URL: http://svn.apache.org/viewvc?rev=709926&view=rev
Log:
Add LIMIT / OFFSET clause generation method to SelectTranslator lifecycle

 switching Frontbase to the new lifecycle method for LIMIT/OFFSET

Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/frontbase/FrontBaseSelectTranslator.java

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/frontbase/FrontBaseSelectTranslator.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/frontbase/FrontBaseSelectTranslator.java?rev=709926&r1=709925&r2=709926&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/frontbase/FrontBaseSelectTranslator.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/frontbase/FrontBaseSelectTranslator.java
Sun Nov  2 12:57:17 2008
@@ -30,20 +30,14 @@
     static final String SELECT_PREFIX = "SELECT";
 
     @Override
-    public String createSqlString() throws Exception {
-        String sql = super.createSqlString();
+    protected void appendLimitAndOffsetClauses(StringBuilder buffer) {
 
-        if (!isSuppressingDistinct()) {
-            // limit results
-            int limit = getQuery().getMetaData(getEntityResolver()).getFetchLimit();
-            if (limit > 0 && sql.startsWith(SELECT_PREFIX)) {
-                return SELECT_PREFIX
-                        + " TOP "
-                        + limit
-                        + sql.substring(SELECT_PREFIX.length());
+        int limit = getQuery().getMetaData(getEntityResolver()).getFetchLimit();
+        if (limit > 0 && buffer.length() > SELECT_PREFIX.length()) {
+
+            if (SELECT_PREFIX.equals(buffer.substring(0, SELECT_PREFIX.length()))) {
+                buffer.insert(SELECT_PREFIX.length(), " TOP " + limit);
             }
         }
-
-        return sql;
     }
 }



Mime
View raw message