mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-09-08 18:51:12 +02:00
Merge pull request #728 from tractorcow/3.0-mssql-compatibility-fixes
FIXED: Compatibility fixes for MS SQL Server.
This commit is contained in:
commit
aaa95d2dd5
@ -162,16 +162,16 @@ class Versioned extends DataExtension {
|
|||||||
// Link to the version archived on that date
|
// Link to the version archived on that date
|
||||||
$safeDate = Convert::raw2sql($date);
|
$safeDate = Convert::raw2sql($date);
|
||||||
$query->addWhere(
|
$query->addWhere(
|
||||||
"`{$baseTable}_versions`.`Version` IN
|
"\"{$baseTable}_versions\".\"Version\" IN
|
||||||
(SELECT LatestVersion FROM
|
(SELECT LatestVersion FROM
|
||||||
(SELECT
|
(SELECT
|
||||||
`{$baseTable}_versions`.`RecordID`,
|
\"{$baseTable}_versions\".\"RecordID\",
|
||||||
MAX(`{$baseTable}_versions`.`Version`) AS LatestVersion
|
MAX(\"{$baseTable}_versions\".\"Version\") AS LatestVersion
|
||||||
FROM `{$baseTable}_versions`
|
FROM \"{$baseTable}_versions\"
|
||||||
WHERE `{$baseTable}_versions`.`LastEdited` <= '$safeDate'
|
WHERE \"{$baseTable}_versions\".\"LastEdited\" <= '$safeDate'
|
||||||
GROUP BY `{$baseTable}_versions`.`RecordID`
|
GROUP BY \"{$baseTable}_versions\".\"RecordID\"
|
||||||
) AS `{$baseTable}_versions_latest`
|
) AS \"{$baseTable}_versions_latest\"
|
||||||
WHERE `{$baseTable}_versions_latest`.`RecordID` = `{$baseTable}_versions`.`RecordID`
|
WHERE \"{$baseTable}_versions_latest\".\"RecordID\" = \"{$baseTable}_versions\".\"RecordID\"
|
||||||
)");
|
)");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -214,15 +214,15 @@ class Versioned extends DataExtension {
|
|||||||
// This provides "show all, including deleted" functonality
|
// This provides "show all, including deleted" functonality
|
||||||
if($dataQuery->getQueryParam('Versioned.mode') == 'latest_versions') {
|
if($dataQuery->getQueryParam('Versioned.mode') == 'latest_versions') {
|
||||||
$query->addWhere(
|
$query->addWhere(
|
||||||
"`{$alias}_versions`.`Version` IN
|
"\"{$alias}_versions\".\"Version\" IN
|
||||||
(SELECT LatestVersion FROM
|
(SELECT LatestVersion FROM
|
||||||
(SELECT
|
(SELECT
|
||||||
`{$alias}_versions`.`RecordID`,
|
\"{$alias}_versions\".\"RecordID\",
|
||||||
MAX(`{$alias}_versions`.`Version`) AS LatestVersion
|
MAX(\"{$alias}_versions\".\"Version\") AS LatestVersion
|
||||||
FROM `{$alias}_versions`
|
FROM \"{$alias}_versions\"
|
||||||
GROUP BY `{$alias}_versions`.`RecordID`
|
GROUP BY \"{$alias}_versions\".\"RecordID\"
|
||||||
) AS `{$alias}_versions_latest`
|
) AS \"{$alias}_versions_latest\"
|
||||||
WHERE `{$alias}_versions_latest`.`RecordID` = `{$alias}_versions`.`RecordID`
|
WHERE \"{$alias}_versions_latest\".\"RecordID\" = \"{$alias}_versions\".\"RecordID\"
|
||||||
)");
|
)");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user