Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

FIXED: Compatibility fixes for MS SQL Server. Replaced back ticks (wh…

…ich are mysql specific) with double quotes
  • Loading branch information...
commit f7ffb79542c609e24237f2d6d1522ada48dfc948 1 parent f0340e6
@tractorcow tractorcow authored
Showing with 15 additions and 15 deletions.
  1. +15 −15 model/Versioned.php
View
30 model/Versioned.php
@@ -162,16 +162,16 @@ function augmentSQL(SQLQuery &$query, DataQuery &$dataQuery = null) {
// 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 @@ function augmentSQL(SQLQuery &$query, DataQuery &$dataQuery = null) {
// 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;
Please sign in to comment.
Something went wrong with that request. Please try again.