2010年9月17日星期五

[fw-db] Issue with Zend_Db_Table_Select Pagination and Sqlsrv

Hello,

I have previously used a Zend_Db_Table_Select object for pagination with
MySQL and Postgresql with great success. And now that I am forced to work
on this project in SQL Server 2008, using the Microsoft-provided Sqlsrv
drivers for PHP on Windows, I am coming across an interesting issue. The
pagination is "working", as I see the appropriate links where I should, the
proper number of items are displayed per page, etc. However, on the last
page, I am seeing the maximum number of items, even though some of them
appeared on the next-to-last page. For example: I have a table with 22
rows, and I have it set to display 10 rows per page. The first two pages
will show 1-10, then 11-20, but then the 3rd page shows 10 records (numbered
21-30), even though there are only 22 records. The last two items on the
last page are the only ones that should be showing up, as the first 8 were
already displayed on the previous page. This has caused a great amount of
confusion to my users. They are asking why there are 30 records shown, when
there's only 22 in the database. I have been forced to change my pagination
method to use an Array, thereby losing all of the benefits that I really
need.

To confirm this only happens with SQL Server, I created an identical table
in MySQL and copied all the data over. I changed my config.ini to point to
the MySQL server, and everything displays as it should.

Is this because of the fact that SQL Server doesn't support LIMIT the same
way as MySQL and Postgresql? I was under the impression that the Zend_Db
adapter would mimic this functionality for SQL Server.

Thanks in advance,
Joey
--
View this message in context: http://zend-framework-community.634137.n4.nabble.com/Issue-with-Zend-Db-Table-Select-Pagination-and-Sqlsrv-tp2544029p2544029.html
Sent from the Zend DB mailing list archive at Nabble.com.

没有评论: