Update of /cvsroot/monetdb/sql/src/server
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv17977

Modified Files:
        rel_bin.mx 
Log Message:
Fixed problem with limit and offset (was done twice, ie losing to many rows).


Index: rel_bin.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/server/rel_bin.mx,v
retrieving revision 1.98
retrieving revision 1.99
diff -u -d -r1.98 -r1.99
--- rel_bin.mx  9 Nov 2009 22:06:36 -0000       1.98
+++ rel_bin.mx  22 Nov 2009 16:14:08 -0000      1.99
@@ -1450,14 +1450,15 @@
        list *pl; 
        node *en, *n;
        stmt *sub = NULL, *psub = NULL;
-       int l = -1, o = 0;
+       int l = -1;
 
        if (topn) {
+               int o = topn_offset(topn);
                l = topn_limit(topn);
-               o = topn_offset(topn);
                if (l < 0) /* for now only handle topn 
                                including limit, ie not just offset */
                        topn = NULL;
+               l += o;
        }
 
        if (!rel->exps) 
@@ -1509,7 +1510,7 @@
                        stmt_destroy(sub);
                        return NULL;
                }
-               limit = stmt_limit(orderbycols, o, l, 
LIMIT_DIRECTION(is_ascending(orderbycole), 1, 1));
+               limit = stmt_limit(orderbycols, 0, l, 
LIMIT_DIRECTION(is_ascending(orderbycole), 1, 1));
                for ( n=pl->h ; n; n = n->next) {
                        list_append(npl, 
                                stmt_semijoin(column(stmt_dup(n->data)), 


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Monetdb-sql-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-sql-checkins

Reply via email to