News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Daniel Cousineau's Blog:
Doctrine 1.2 MSSQL Alternative LIMIT/Paging
September 17, 2010 @ 11:34:03

Daniel Cousineau has a new post to his blog today looking at an alternative that can be used for pagination in your MSSQL queries than the trick with TOP and reversing the ORDER BY in Doctrine.

As ugly as this technique is, it works. The problem is it requires an extreme amount of intelligence or an extreme amount of simplicity in the query in order for an automated system like Doctrine to be usable. The biggest caveat with this technique is good goddamned luck paging your query if it doesn't have an ORDER BY. And sometimes queries that are complex enough break the modified Zend_Db code. There exists an easier MSSQL paging technique. Using features first available in SQL Server 2005, with only 1 subquery you can mimic MySQL's LIMIT clause with ease.

He includes the query that will make it happen (the SQL for it) and then the implementation as an adapter you can use to get it to cooperate in your Doctrine queries.

0 comments voice your opinion now!
mssql doctrine limit paging adapter


blog comments powered by Disqus

Similar Posts

Juozas Kaziukenas' Blog: Zend Framework and Doctrine. Part 1

Jeremy Cook's Blog: Normalising DateTimes with Doctrine Events

Brian Swan's Blog: MSSQL vs. SQLSRV: What’s the Difference? (Part 2)

ZendCasts.com: Logging with Timestamps and Doctrine Event Listeners

Jani Hartikainen's Blog: How to create Doctrine 1-style Soft-Delete in Doctrine 2


Community Events

Don't see your event here?
Let us know!


interview introduction community install laravel release voicesoftheelephpant extension series example framework opinion xdebug api php7 version unittest library language podcast

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework