@@ -142,13 +142,13 @@ class SQLServerPlatformTest extends AbstractPlatformTestCase
publicfunctiontestModifyLimitQuery()
{
$sql=$this->_platform->modifyLimitQuery('SELECT * FROM user',10,0);
$this->assertEquals('SELECT TOP 10 * FROM user',$sql);
$this->assertEquals('SELECT * FROM (SELECT *, ROW_NUMBER() OVER (ORDER BY (SELECT 0)) AS doctrine_rownum FROM user) AS doctrine_tbl WHERE doctrine_rownum BETWEEN 1 AND 10',$sql);
$sql=$this->_platform->modifyLimitQuery('SELECT * FROM user',10);
$this->assertEquals('SELECT TOP 10 * FROM user',$sql);
$this->assertEquals('SELECT * FROM (SELECT *, ROW_NUMBER() OVER (ORDER BY (SELECT 0)) AS doctrine_rownum FROM user) AS doctrine_tbl WHERE doctrine_rownum BETWEEN 1 AND 10',$sql);
}
publicfunctiontestModifyLimitQueryWithOffset()
...
...
@@ -160,13 +160,40 @@ class SQLServerPlatformTest extends AbstractPlatformTestCase
$sql=$this->_platform->modifyLimitQuery('SELECT * FROM user ORDER BY username ASC',10);
$this->assertEquals('SELECT TOP 10 * FROM user ORDER BY username ASC',$sql);
$this->assertEquals('SELECT * FROM (SELECT *, ROW_NUMBER() OVER (ORDER BY username ASC) AS doctrine_rownum FROM user) AS doctrine_tbl WHERE doctrine_rownum BETWEEN 1 AND 10',$sql);
$sql=$this->_platform->modifyLimitQuery('SELECT * FROM user ORDER BY username DESC',10);
$this->assertEquals('SELECT TOP 10 * FROM user ORDER BY username DESC',$sql);
$this->assertEquals('SELECT * FROM (SELECT *, ROW_NUMBER() OVER (ORDER BY username DESC) AS doctrine_rownum FROM user) AS doctrine_tbl WHERE doctrine_rownum BETWEEN 1 AND 10',$sql);
$sql=$this->_platform->modifyLimitQuery('SELECT * FROM user ORDER BY username DESC, usereamil ASC',10);
$this->assertEquals('SELECT * FROM (SELECT *, ROW_NUMBER() OVER (ORDER BY username DESC, usereamil ASC) AS doctrine_rownum FROM user) AS doctrine_tbl WHERE doctrine_rownum BETWEEN 1 AND 10',$sql);
}
publicfunctiontestModifyLimitQueryWithSubSelect()
{
$sql=$this->_platform->modifyLimitQuery('SELECT * FROM (SELECT u.id as uid, u.name as uname) dctrn_result',10);
$this->assertEquals('SELECT * FROM (SELECT *, ROW_NUMBER() OVER (ORDER BY (SELECT 0)) AS doctrine_rownum FROM (SELECT u.id as uid, u.name as uname) dctrn_result) AS doctrine_tbl WHERE doctrine_rownum BETWEEN 1 AND 10',$sql);
$sql=$this->_platform->modifyLimitQuery('SELECT * FROM (SELECT u.id as uid, u.name as uname ORDER BY u.name DESC) dctrn_result',10);
$this->assertEquals('SELECT * FROM (SELECT *, ROW_NUMBER() OVER (ORDER BY uname DESC) AS doctrine_rownum FROM (SELECT u.id as uid, u.name as uname) dctrn_result) AS doctrine_tbl WHERE doctrine_rownum BETWEEN 1 AND 10',$sql);
$sql=$this->_platform->modifyLimitQuery('SELECT * FROM (SELECT u.id as uid, u.name as uname ORDER BY u.name DESC, id ASC) dctrn_result',10,5);
$this->assertEquals('SELECT * FROM (SELECT *, ROW_NUMBER() OVER (ORDER BY uname DESC, uid ASC) AS doctrine_rownum FROM (SELECT u.id as uid, u.name as uname) dctrn_result) AS doctrine_tbl WHERE doctrine_rownum BETWEEN 6 AND 15',$sql);
$sql=$this->_platform->modifyLimitQuery('SELECT * FROM (SELECT u.id uid, u.name uname ORDER BY u.name DESC, id ASC) dctrn_result',10,5);
$this->assertEquals('SELECT * FROM (SELECT *, ROW_NUMBER() OVER (ORDER BY uname DESC, uid ASC) AS doctrine_rownum FROM (SELECT u.id uid, u.name uname) dctrn_result) AS doctrine_tbl WHERE doctrine_rownum BETWEEN 6 AND 15',$sql);