Permalink
Browse files

Merge branch 'master' of git://github.com/fabiorphp/zf2 into fabiorph…

…p-master
  • Loading branch information...
2 parents 57a89f8 + 057c480 commit 4474a0f777eb5162dd80407d544e7e152ab3dc23 @ralphschindler ralphschindler committed Jan 7, 2013
@@ -121,7 +121,7 @@ protected function processLimitOffset(PlatformInterface $platform, Adapter $adap
$orderBy = $sqls[self::ORDER];
unset($sqls[self::ORDER]);
} else {
- $orderBy = 'SELECT 1';
+ $orderBy = 'ORDER BY (SELECT 1)';
}
// add a column for row_number() using the order specification
@@ -76,9 +76,9 @@ public function dataProvider()
$select1 = new Select;
$select1->from('foo')->columns(array('bar', 'bam' => 'baz'))->limit(5)->offset(10);
- $expectedPrepareSql1 = 'SELECT [bar], [bam] FROM ( SELECT [foo].[bar] AS [bar], [foo].[baz] AS [bam], ROW_NUMBER() OVER (SELECT 1) AS [__ZEND_ROW_NUMBER] FROM [foo] ) AS [ZEND_SQL_SERVER_LIMIT_OFFSET_EMULATION] WHERE [ZEND_SQL_SERVER_LIMIT_OFFSET_EMULATION].[__ZEND_ROW_NUMBER] BETWEEN ?+1 AND ?+?';
+ $expectedPrepareSql1 = 'SELECT [bar], [bam] FROM ( SELECT [foo].[bar] AS [bar], [foo].[baz] AS [bam], ROW_NUMBER() OVER (ORDER BY (SELECT 1)) AS [__ZEND_ROW_NUMBER] FROM [foo] ) AS [ZEND_SQL_SERVER_LIMIT_OFFSET_EMULATION] WHERE [ZEND_SQL_SERVER_LIMIT_OFFSET_EMULATION].[__ZEND_ROW_NUMBER] BETWEEN ?+1 AND ?+?';
$expectedParams1 = array('offset' => 10, 'limit' => 5, 'offsetForSum' => 10);
- $expectedSql1 = 'SELECT [bar], [bam] FROM ( SELECT [foo].[bar] AS [bar], [foo].[baz] AS [bam], ROW_NUMBER() OVER (SELECT 1) AS [__ZEND_ROW_NUMBER] FROM [foo] ) AS [ZEND_SQL_SERVER_LIMIT_OFFSET_EMULATION] WHERE [ZEND_SQL_SERVER_LIMIT_OFFSET_EMULATION].[__ZEND_ROW_NUMBER] BETWEEN 10+1 AND 5+10';
+ $expectedSql1 = 'SELECT [bar], [bam] FROM ( SELECT [foo].[bar] AS [bar], [foo].[baz] AS [bam], ROW_NUMBER() OVER (ORDER BY (SELECT 1)) AS [__ZEND_ROW_NUMBER] FROM [foo] ) AS [ZEND_SQL_SERVER_LIMIT_OFFSET_EMULATION] WHERE [ZEND_SQL_SERVER_LIMIT_OFFSET_EMULATION].[__ZEND_ROW_NUMBER] BETWEEN 10+1 AND 5+10';
$select2 = new Select;
$select2->from('foo')->order('bar')->limit(5)->offset(10);

0 comments on commit 4474a0f

Please sign in to comment.