FluentData Mysql paging BUG

Source: Internet
Author: User

Development Environment

FluentData3.0, VS. NET2010, and Mysql5.0

 

Problem description

When a table (with 28 records) is paged using FluentData, a strange problem is suddenly found. The first page returns 10 normal data records, and the second page returns 18 data records, the third page returns 8 data records

After code issues are eliminated, the generated paging SQL statements are obtained page by page.

Page 1: select * from orders order by orderid limit 0, 10

Page 2: select * from orders order by orderid limit 10, 20

Page 3: select * from orders order by orderid limit 20, 30

At first glance, it seems that there is no problem, but for those familiar with mysql paging, we should soon be able to see the problem. The second parameter of limit should be PageSize.

 

BUG Locating

The BUG source code is in FluentData \ Providers \ MysqlProvider. cs. The problem code is as follows:

  sql = =  ++=  + (data.WhereSql.Length > +=  + (data.GroupBy.Length > +=  + (data.Having.Length > +=  + (data.OrderBy.Length > +=  + (data.PagingItemsPerPage >                 && data.PagingCurrentPage > += .Format(, data.GetFromItems() - 

 

BUG fixes

SQL + =. Format (, data. GetFromItems ()-1, data. GetToItems ());

Should be changed

SQL + =. Format (, data. GetFromItems ()-1, data. PagingItemsPerPage );

After re-compilation, everything is normal. It is estimated that the author of FluentData did not test it in Mysql.

However, FluentData is indeed a very good lightweight ORM framework. It has made some packages and is easy to use.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.