mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +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
|
||||
$safeDate = Convert::raw2sql($date);
|
||||
$query->addWhere(
|
||||
"`{$baseTable}_versions`.`Version` IN
|
||||
"\"{$baseTable}_versions\".\"Version\" IN
|
||||
(SELECT LatestVersion FROM
|
||||
(SELECT
|
||||
`{$baseTable}_versions`.`RecordID`,
|
||||
MAX(`{$baseTable}_versions`.`Version`) AS LatestVersion
|
||||
FROM `{$baseTable}_versions`
|
||||
WHERE `{$baseTable}_versions`.`LastEdited` <= '$safeDate'
|
||||
GROUP BY `{$baseTable}_versions`.`RecordID`
|
||||
) AS `{$baseTable}_versions_latest`
|
||||
WHERE `{$baseTable}_versions_latest`.`RecordID` = `{$baseTable}_versions`.`RecordID`
|
||||
\"{$baseTable}_versions\".\"RecordID\",
|
||||
MAX(\"{$baseTable}_versions\".\"Version\") AS LatestVersion
|
||||
FROM \"{$baseTable}_versions\"
|
||||
WHERE \"{$baseTable}_versions\".\"LastEdited\" <= '$safeDate'
|
||||
GROUP BY \"{$baseTable}_versions\".\"RecordID\"
|
||||
) AS \"{$baseTable}_versions_latest\"
|
||||
WHERE \"{$baseTable}_versions_latest\".\"RecordID\" = \"{$baseTable}_versions\".\"RecordID\"
|
||||
)");
|
||||
break;
|
||||
|
||||
@ -214,15 +214,15 @@ class Versioned extends DataExtension {
|
||||
// This provides "show all, including deleted" functonality
|
||||
if($dataQuery->getQueryParam('Versioned.mode') == 'latest_versions') {
|
||||
$query->addWhere(
|
||||
"`{$alias}_versions`.`Version` IN
|
||||
"\"{$alias}_versions\".\"Version\" IN
|
||||
(SELECT LatestVersion FROM
|
||||
(SELECT
|
||||
`{$alias}_versions`.`RecordID`,
|
||||
MAX(`{$alias}_versions`.`Version`) AS LatestVersion
|
||||
FROM `{$alias}_versions`
|
||||
GROUP BY `{$alias}_versions`.`RecordID`
|
||||
) AS `{$alias}_versions_latest`
|
||||
WHERE `{$alias}_versions_latest`.`RecordID` = `{$alias}_versions`.`RecordID`
|
||||
\"{$alias}_versions\".\"RecordID\",
|
||||
MAX(\"{$alias}_versions\".\"Version\") AS LatestVersion
|
||||
FROM \"{$alias}_versions\"
|
||||
GROUP BY \"{$alias}_versions\".\"RecordID\"
|
||||
) AS \"{$alias}_versions_latest\"
|
||||
WHERE \"{$alias}_versions_latest\".\"RecordID\" = \"{$alias}_versions\".\"RecordID\"
|
||||
)");
|
||||
}
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user