Paging not showing the LIMIT clause in the output window

Posts   
 
    
MarcoP avatar
MarcoP
User
Posts: 270
Joined: 29-Sep-2004
# Posted on: 06-Jan-2011 15:15:17   

I am using paging with the MySql driver and when I view the query in the output window, I do not see a LIMIT clause being used. Is this correct, maybe it is being used behind the scenes?

I didn't put all my version info in this post bc I thought it was just a yes or no answer. Let me know if u need it.

here is my code: page = 1 and pagesize = 25

            var b = query
                .Where(Predicate)
                .Skip((Page - 1) * PageSize)
                .Take(PageSize)
                .ToList();

However, this shows the LIMIT in the window

var z = query.Where(Predicate).TakePage(Page, PageSize).ToList();

Whats the difference? Also, using Take() on a query does NOT add the LIMIT clause. Seems like only TakePage does? What if I just want 10 records?

Thanks!

MTrinder
User
Posts: 1461
Joined: 08-Oct-2008
# Posted on: 06-Jan-2011 21:54:16   

They should do the same thing if the values in your Skip and Take can be used properly to calculate page sizes (which yours are)

Could you please post the generated SQL in both cases ?

Thanks

Matt

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 07-Jan-2011 14:25:01   

If skip isn't compatible with take (e.g. you do Skip(3).Take(10)) to create a page, they're ignored.

Frans Bouma | Lead developer LLBLGen Pro