mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
FIXED: Compatibility fixes for MS SQL Server. Replaced back ticks (which are mysql specific) with double quotes
This commit is contained in:
parent
f0340e698f
commit
f7ffb79542
@ -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…
x
Reference in New Issue
Block a user