mirror of
https://github.com/silverstripe/silverstripe-mssql
synced 2024-10-22 08:05:53 +02:00
BUGFIX: Remove an extraneous space from the generated queries so that SQLQueryTest passes
This commit is contained in:
parent
0585ef3908
commit
ff739d1786
@ -1028,7 +1028,7 @@ class MSSQLDatabase extends Database {
|
|||||||
// If there's a limit but no offset, just use 'TOP X'
|
// If there's a limit but no offset, just use 'TOP X'
|
||||||
// rather than the more complex sub-select method
|
// rather than the more complex sub-select method
|
||||||
if ($limit != 0 && $offset == 0) {
|
if ($limit != 0 && $offset == 0) {
|
||||||
$text = "SELECT TOP $limit $distinct ";
|
$text = "SELECT TOP $limit $distinct";
|
||||||
|
|
||||||
// If there's a limit and an offset, then we need to do a subselect
|
// If there's a limit and an offset, then we need to do a subselect
|
||||||
} else if($limit && $offset) {
|
} else if($limit && $offset) {
|
||||||
@ -1038,14 +1038,14 @@ class MSSQLDatabase extends Database {
|
|||||||
$firstCol = reset($sqlQuery->select);
|
$firstCol = reset($sqlQuery->select);
|
||||||
$rowNumber = "ROW_NUMBER() OVER (ORDER BY $firstCol) AS Number";
|
$rowNumber = "ROW_NUMBER() OVER (ORDER BY $firstCol) AS Number";
|
||||||
}
|
}
|
||||||
$text = "SELECT * FROM ( SELECT $rowNumber, ";
|
$text = "SELECT * FROM ( SELECT $distinct$rowNumber, ";
|
||||||
$suffixText .= ") AS Numbered WHERE Number BETWEEN " . ($offset+1) ." AND " . ($offset+$limit)
|
$suffixText .= ") AS Numbered WHERE Number BETWEEN " . ($offset+1) ." AND " . ($offset+$limit)
|
||||||
. " ORDER BY Number";
|
. " ORDER BY Number";
|
||||||
$nestedQuery = true;
|
$nestedQuery = true;
|
||||||
|
|
||||||
// Otherwise a simple query
|
// Otherwise a simple query
|
||||||
} else {
|
} else {
|
||||||
$text = "SELECT $distinct ";
|
$text = "SELECT $distinct";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now add the columns to be selected
|
// Now add the columns to be selected
|
||||||
|
Loading…
Reference in New Issue
Block a user