Home
Help
Register
Log in

Search

 
   Active Threads  

You are here: Home > LLBLGen Pro > Bugs & Issues> Adapter Paging Bug
 

Pages: 1
Bugs & Issues
Adapter Paging Bug
Page:1/1 

  Print all messages in this thread  
Poster Message
arschr
User



Location:
Atlanta, Georgia; USA
Joined on:
14-Dec-2003 16:57:29
Posted:
887 posts
# Posted on: 07-Nov-2013 17:30:32.  
The documentation on paging says
Quote:
Paging is disabled if you pass 0 for the page number or 0 or 1 for the page size.


My tests show it is not disabled, but instead treats a page number of 0 as if it were a page number of 1, honoring page size, rather than max number of records.

SD.LLBLGen.Pro.DQE.SqlServer: File Version 4.0.13.523
SD.LLBLGen.Pro.ORMSupportClasses: File Version 4.0.13.725

The following test passes all asserts, but the 3rd should fail,
Code:

[Test]
        public void PagingTest01()
        {
            using (var adapter = new DataAccessAdapter())
            {
                int maxRecords = 200;
                int pageNoZero = 0;
                int pageNoOne = 1;
                int pageSize = 100;
                var invoiceId = 479937;
                var rpb = new RelationPredicateBucket(LifelineDetailV2Fields.InvoiceId == invoiceId);
                var sortExpression = new SortExpression(LifelineDetailV2Fields.RowId | SortOperator.Ascending);
                var collection1 = new EntityCollection<LifelineDetailV2Entity>();
                var collection2 = new EntityCollection<LifelineDetailV2Entity>();
                var collection3 = new EntityCollection<LifelineDetailV2Entity>();
                var collection4 = new EntityCollection<LifelineDetailV2Entity>();
                adapter.FetchEntityCollection(collection1, rpb);
                adapter.FetchEntityCollection(collection2, rpb,maxRecords,sortExpression);
                adapter.FetchEntityCollection(collection3, rpb,maxRecords,sortExpression,pageNoZero,pageSize);
                adapter.FetchEntityCollection(collection4, rpb, maxRecords, sortExpression, pageNoOne, pageSize);

                Assert.AreEqual(517,collection1.Count);
                Assert.AreEqual(200, collection2.Count);
                Assert.AreEqual(100, collection3.Count);
                Assert.AreEqual(100, collection4.Count);

                var results = string.Format("collection1:{0}|collection2:{1}|collection3:{2}|collection4:{3}", collection1.Count, collection2.Count, collection3.Count,
                    collection4.Count);
                Console.WriteLine(results);
                Assert.AreEqual(collection3[0].RowId,collection4[0].RowId);


            }
        }



- Al  Top
Walaa
Support Team



Location:

Joined on:
21-Aug-2005 16:03:48
Posted:
14626 posts
# Posted on: 08-Nov-2013 06:45:38.  
Reproduced.

Whenever PageSize is used, it gets honored on favor of the maxRecords, even if the PageNo is 0.


  Top
daelmo
Support Team



Location:
Guatemala City
Joined on:
28-Nov-2005 23:35:24
Posted:
8137 posts
# Posted on: 08-Nov-2013 07:05:07.  
That's right. If you see the source code, pageSize has precedence over maxNumberRows:
Code:
/// <summary>
/// Calculates the row skip / take values from the 3 values from the pre-v4 api.
/// </summary>
/// <param name="pageNumber">The page number.</param>
/// <param name="pageSize">Size of the page.</param>
/// <param name="maxNumberOfItemsToReturn">The max number of items to return.</param>
/// <param name="rowsToSkip">The rows to skip.</param>
/// <param name="rowsToTake">The rows to take.</param>
public static void CalculateRowSkipTake(int pageNumber, int pageSize, int maxNumberOfItemsToReturn, out int rowsToSkip, out int rowsToTake)
{
    rowsToTake = (pageSize <= 0) ? maxNumberOfItemsToReturn : pageSize;
    rowsToSkip = 0;
    if(pageNumber > 0)
    {
        rowsToSkip = rowsToTake > 0 ? ((pageNumber - 1) * rowsToTake) : 0;
    }
}

We will see into whether or not this is something to fix or just update the docs.
David Elizondo
LLBLGen'ing (articles and code snippets) | linkedin | twitter
 
Top
Otis
LLBLGen Pro Team



Location:
The Hague, The Netherlands
Joined on:
17-Aug-2003 18:00:36
Posted:
38047 posts
# Posted on: 08-Nov-2013 10:02:55.  
Ah indeed. It should take pageSize over maxRows, because if paging is specified, maxrows has no meaning. However, it should only do that if the two paging values (pagesize, pagenumer) are both valid, otherwise they should be ignored.

A bug Regular Smiley Will fix.


Frans Bouma
LLBLGen Pro / ORM Profiler Lead Developer | Blog | Twitter
 
Top
Otis
LLBLGen Pro Team



Location:
The Hague, The Netherlands
Joined on:
17-Aug-2003 18:00:36
Posted:
38047 posts
# Posted on: 08-Nov-2013 10:54:49. Goto attachments  
Fixed in attached dll.
Frans Bouma
LLBLGen Pro / ORM Profiler Lead Developer | Blog | Twitter
 
Top
arschr
User



Location:
Atlanta, Georgia; USA
Joined on:
14-Dec-2003 16:57:29
Posted:
887 posts
# Posted on: 08-Nov-2013 13:00:52.  
Thanks, I'll test it.

- Al  Top
arschr
User



Location:
Atlanta, Georgia; USA
Joined on:
14-Dec-2003 16:57:29
Posted:
887 posts
# Posted on: 05-Dec-2013 16:40:12.  
Finally tested this (using v4.1)
It is fixed
- Al  Top
Otis
LLBLGen Pro Team



Location:
The Hague, The Netherlands
Joined on:
17-Aug-2003 18:00:36
Posted:
38047 posts
# Posted on: 05-Dec-2013 17:11:27.  
*pfew* Regular Smiley

Frans Bouma
LLBLGen Pro / ORM Profiler Lead Developer | Blog | Twitter
 
Top
Pages: 1  


Powered by HnD ©2002-2007 Solutions Design
HnD uses LLBLGen Pro

Version: 2.1.12172008 Final.