cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dkazimirc...@apache.org
Subject svn commit: r1158315 - in /cayenne/main/branches/STABLE-3.0: docs/doc/src/main/resources/RELEASE-NOTES.txt framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/sqlserver/SQLServerSelectTranslator.java
Date Tue, 16 Aug 2011 15:09:47 GMT
Author: dkazimirchyk
Date: Tue Aug 16 15:09:47 2011
New Revision: 1158315

URL: http://svn.apache.org/viewvc?rev=1158315&view=rev
Log:
CAY-1596 setFetchOffset & setFetchLimit issue under SQL Server 2008 R2 64Bit

need to read from database (offset + limit) rows and then apply offset to received result

Modified:
    cayenne/main/branches/STABLE-3.0/docs/doc/src/main/resources/RELEASE-NOTES.txt
    cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/sqlserver/SQLServerSelectTranslator.java

Modified: cayenne/main/branches/STABLE-3.0/docs/doc/src/main/resources/RELEASE-NOTES.txt
URL: http://svn.apache.org/viewvc/cayenne/main/branches/STABLE-3.0/docs/doc/src/main/resources/RELEASE-NOTES.txt?rev=1158315&r1=1158314&r2=1158315&view=diff
==============================================================================
--- cayenne/main/branches/STABLE-3.0/docs/doc/src/main/resources/RELEASE-NOTES.txt (original)
+++ cayenne/main/branches/STABLE-3.0/docs/doc/src/main/resources/RELEASE-NOTES.txt Tue Aug
16 15:09:47 2011
@@ -24,6 +24,7 @@ CAY-1577 SQL queries for LIKE expression
 CAY-1581 Not-Escaping <> during serialization to *.map.xml
 CAY-1583 context.getObjectStore() returning null causing NullpointerException in DataMergeHandler
 CAY-1585 SelectQuery automatic cache key needs FetchOffset
+CAY-1596 setFetchOffset & setFetchLimit issue under SQL Server 2008 R2 64Bit
 
 ----------------------------------
 Release: 3.0.2

Modified: cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/sqlserver/SQLServerSelectTranslator.java
URL: http://svn.apache.org/viewvc/cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/sqlserver/SQLServerSelectTranslator.java?rev=1158315&r1=1158314&r2=1158315&view=diff
==============================================================================
--- cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/sqlserver/SQLServerSelectTranslator.java
(original)
+++ cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/sqlserver/SQLServerSelectTranslator.java
Tue Aug 16 15:09:47 2011
@@ -28,16 +28,17 @@ public class SQLServerSelectTranslator e
         QueryMetadata metadata = getQuery().getMetaData(getEntityResolver());
         
         int limit = metadata.getFetchLimit();
+        int offset = metadata.getFetchOffset();
         
         if (limit > 0) {
         	String sql = buffer.toString();
         	
         	// If contains distinct insert top limit after
         	if (sql.startsWith("SELECT DISTINCT ")) {
-        		buffer.replace(0, 15, "SELECT DISTINCT TOP " + limit);	
+        		buffer.replace(0, 15, "SELECT DISTINCT TOP " + (offset + limit));	
         		
         	} else {
-        		buffer.replace(0, 6, "SELECT TOP " + limit);	
+        		buffer.replace(0, 6, "SELECT TOP " + (offset + limit));	
         	}
         }
     }



Mime
View raw message