Hello,
I am developing my silverstripe page with Microsoft SQL Server and there are some problems with the event calendar module.
1. It uses '`' hardcoded as field and table qualifiers. SQL Server only accepts '"' or square brackets '[' and ']'. The base silverstripe framework uses '"', so I think there should be some constant for this...
2. The query for getrecurrengEvents has a Sort Order Defined: "`CalendarDateTime`.StartDate ASC"
SqL Server won't accept this. The table CalendarDateTime is joined in the query, but no field of it is in the group by clause, so SQL Server won't allow this sort order.
The whole Query with replaced field qualifiers:
SELECT
"SiteTree_Live"."ClassName",
"SiteTree_Live"."Created",
"SiteTree_Live"."LastEdited",
"SiteTree_Live"."URLSegment",
"SiteTree_Live"."Title",
"SiteTree_Live"."MenuTitle",
"SiteTree_Live"."Content",
"SiteTree_Live"."MetaTitle",
"SiteTree_Live"."MetaDescription",
"SiteTree_Live"."MetaKeywords",
"SiteTree_Live"."ExtraMeta",
"SiteTree_Live"."ShowInMenus",
"SiteTree_Live"."ShowInSearch",
"SiteTree_Live"."HomepageForDomain",
"SiteTree_Live"."ProvideComments",
"SiteTree_Live"."Sort",
"SiteTree_Live"."HasBrokenFile",
"SiteTree_Live"."HasBrokenLink",
"SiteTree_Live"."Status",
"SiteTree_Live"."ReportClass",
"SiteTree_Live"."CanViewType",
"SiteTree_Live"."CanEditType",
"SiteTree_Live"."ToDo",
"SiteTree_Live"."Version",
"SiteTree_Live"."Priority",
"SiteTree_Live"."ParentID",
"Page_Live"."ImageID",
"CalendarEvent_Live"."Recursion",
"CalendarEvent_Live"."CustomRecursionType",
"CalendarEvent_Live"."DailyInterval",
"CalendarEvent_Live"."WeeklyInterval",
"CalendarEvent_Live"."MonthlyInterval",
"CalendarEvent_Live"."MonthlyRecursionType1",
"CalendarEvent_Live"."MonthlyRecursionType2",
"CalendarEvent_Live"."MonthlyIndex",
"CalendarEvent_Live"."MonthlyDayOfWeek",
"CalendarEvent_Live"."CalendarID",
"SiteTree_Live"."ID",
CASE WHEN "SiteTree_Live"."ClassName" IS NOT NULL THEN "SiteTree_Live"."ClassName" ELSE 'SiteTree' END AS "RecordClassName"
FROM "SiteTree_Live"
LEFT JOIN "Page_Live" ON "Page_Live"."ID" = "SiteTree_Live"."ID"
LEFT JOIN "CalendarEvent_Live" ON "CalendarEvent_Live"."ID" = "SiteTree_Live"."ID"
LEFT JOIN "CalendarDateTime" ON "CalendarDateTime".EventID = "CalendarEvent_Live".ID
WHERE
("SiteTree_Live"."ClassName" IN ('CalendarEvent'))
AND (Recursion = 1 AND ParentID = 12)
GROUP BY
"SiteTree_Live"."ClassName",
"SiteTree_Live"."Created",
"SiteTree_Live"."LastEdited",
"SiteTree_Live"."URLSegment",
"SiteTree_Live"."Title",
"SiteTree_Live"."MenuTitle",
"SiteTree_Live"."Content",
"SiteTree_Live"."MetaTitle",
"SiteTree_Live"."MetaDescription",
"SiteTree_Live"."MetaKeywords",
"SiteTree_Live"."ExtraMeta",
"SiteTree_Live"."ShowInMenus",
"SiteTree_Live"."ShowInSearch",
"SiteTree_Live"."HomepageForDomain",
"SiteTree_Live"."ProvideComments",
"SiteTree_Live"."Sort",
"SiteTree_Live"."HasBrokenFile",
"SiteTree_Live"."HasBrokenLink",
"SiteTree_Live"."Status",
"SiteTree_Live"."ReportClass",
"SiteTree_Live"."CanViewType",
"SiteTree_Live"."CanEditType",
"SiteTree_Live"."ToDo",
"SiteTree_Live"."Version",
"SiteTree_Live"."Priority",
"SiteTree_Live"."ParentID",
"Page_Live"."ImageID",
"CalendarEvent_Live"."Recursion",
"CalendarEvent_Live"."CustomRecursionType",
"CalendarEvent_Live"."DailyInterval",
"CalendarEvent_Live"."WeeklyInterval",
"CalendarEvent_Live"."MonthlyInterval",
"CalendarEvent_Live"."MonthlyRecursionType1",
"CalendarEvent_Live"."MonthlyRecursionType2",
"CalendarEvent_Live"."MonthlyIndex",
"CalendarEvent_Live"."MonthlyDayOfWeek",
"CalendarEvent_Live"."CalendarID",
"SiteTree_Live"."ID",
CASE WHEN "SiteTree_Live"."ClassName" IS NOT NULL THEN "SiteTree_Live"."ClassName" ELSE 'SiteTree' END
ORDER BY "CalendarDateTime".StartDate ASC
The Error message:
Column "CalendarDateTime.StartDate" is invalid in the ORDER BY clause because it is not contained in either an aggregate function or the GROUP BY clause.
First I will try to get rid of the field qualifier thing... Perhaps anyone has an idea about the second thing...
BR
Markus Alexander