Commit 0859d4be authored by Benjamin Eberlei's avatar Benjamin Eberlei

Merge branch 'DBAL-82' into 2.0.x

parents b03d65e9 df33ddf1
...@@ -607,14 +607,12 @@ class MsSqlPlatform extends AbstractPlatform ...@@ -607,14 +607,12 @@ class MsSqlPlatform extends AbstractPlatform
// Remove ORDER BY clause from $query // Remove ORDER BY clause from $query
$query = preg_replace('/\s+ORDER BY(.*)/', '', $query); $query = preg_replace('/\s+ORDER BY(.*)/', '', $query);
$query = preg_replace('/^SELECT\s/', '', $query);
// Add ORDER BY clause as an argument for ROW_NUMBER()
$query = "SELECT ROW_NUMBER() OVER ($over) AS \"doctrine_rownum\", * FROM ($query) AS inner_tbl";
$start = $offset + 1; $start = $offset + 1;
$end = $offset + $count; $end = $offset + $count;
$query = "WITH outer_tbl AS ($query) SELECT * FROM outer_tbl WHERE \"doctrine_rownum\" BETWEEN $start AND $end"; $query = "SELECT * FROM (SELECT ROW_NUMBER() OVER ($over) AS \"doctrine_rownum\", $query) AS doctrine_tbl WHERE \"doctrine_rownum\" BETWEEN $start AND $end";
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment