From f68364e28e2de5765db67735e925fd4c32ed10e5 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Tue, 30 Dec 2014 20:06:22 +0000 Subject: Fix case of SQL --- p2pvr/daemon/schedules.cpp | 4 ++-- p2pvr/daemon/sql/Schedules_GetCandidates.sql | 26 -------------------------- p2pvr/daemon/sql/Schedules_getCandidates.sql | 26 ++++++++++++++++++++++++++ 3 files changed, 28 insertions(+), 28 deletions(-) delete mode 100644 p2pvr/daemon/sql/Schedules_GetCandidates.sql create mode 100644 p2pvr/daemon/sql/Schedules_getCandidates.sql diff --git a/p2pvr/daemon/schedules.cpp b/p2pvr/daemon/schedules.cpp index b97924d..abb3b46 100644 --- a/p2pvr/daemon/schedules.cpp +++ b/p2pvr/daemon/schedules.cpp @@ -12,7 +12,7 @@ #include #include -ResourceString(Schedules_GetCandidates, sql_Schedules_GetCandidates); +ResourceString(Schedules_getCandidates, sql_Schedules_getCandidates); ResourceString(Schedules_insert, sql_Schedules_insert); ResourceString(Schedules_insertNewId, sql_Schedules_insertNewId); ResourceString(Schedules_update, sql_Schedules_update); @@ -318,7 +318,7 @@ Schedules::DoReschedule(const Ice::Current & ice) // Load list from database ScheduleCandidates episodes; SqlContainerCreator cct(episodes); - cct.populate(Select(Schedules_GetCandidates).second); + cct.populate(Select(Schedules_getCandidates).second); Episodes scheduleList; Showings allShowings; diff --git a/p2pvr/daemon/sql/Schedules_GetCandidates.sql b/p2pvr/daemon/sql/Schedules_GetCandidates.sql deleted file mode 100644 index 0bb7bd8..0000000 --- a/p2pvr/daemon/sql/Schedules_GetCandidates.sql +++ /dev/null @@ -1,26 +0,0 @@ -select what, eventuid, transportstreamid, - starttime - early starttime, stoptime + late stoptime, - priority, scheduleid -from ( - select (e.title, e.subtitle, e.description)::text what, e.eventuid, sv.transportstreamid, - e.starttime, e.stoptime - interval '1 second' stoptime, - s.early, s.late, s.scheduleid, s.priority, - rank() over(partition by e.eventuid, sv.serviceid order by s.priority desc, s.scheduleid) schedulerank - from services sv, events e, schedules s - where (s.serviceid is null or s.serviceid = e.serviceid) - and (s.title is null or lower(s.title) = lower(e.title)) - and (s.eventuid is null or s.eventuid = e.eventuid) - and (s.search is null or event_tsvector(e) @@ plainto_tsquery(s.search)) - and sv.serviceid = e.serviceid - and e.stoptime > now() - and not exists ( - select 1 - from recorded r, events re - where r.eventuid = re.eventuid - and lower(e.title) = lower(re.title) - and coalesce(lower(e.subtitle), '') = coalesce(lower(re.subtitle), '') - and ts_rank(to_tsvector(e.description), plainto_tsquery(re.description)) + - ts_rank(to_tsvector(re.description), plainto_tsquery(e.description)) > 1)) e -where e.schedulerank = 1 -order by e.priority desc, e.what, e.transportstreamid, e.starttime - diff --git a/p2pvr/daemon/sql/Schedules_getCandidates.sql b/p2pvr/daemon/sql/Schedules_getCandidates.sql new file mode 100644 index 0000000..0bb7bd8 --- /dev/null +++ b/p2pvr/daemon/sql/Schedules_getCandidates.sql @@ -0,0 +1,26 @@ +select what, eventuid, transportstreamid, + starttime - early starttime, stoptime + late stoptime, + priority, scheduleid +from ( + select (e.title, e.subtitle, e.description)::text what, e.eventuid, sv.transportstreamid, + e.starttime, e.stoptime - interval '1 second' stoptime, + s.early, s.late, s.scheduleid, s.priority, + rank() over(partition by e.eventuid, sv.serviceid order by s.priority desc, s.scheduleid) schedulerank + from services sv, events e, schedules s + where (s.serviceid is null or s.serviceid = e.serviceid) + and (s.title is null or lower(s.title) = lower(e.title)) + and (s.eventuid is null or s.eventuid = e.eventuid) + and (s.search is null or event_tsvector(e) @@ plainto_tsquery(s.search)) + and sv.serviceid = e.serviceid + and e.stoptime > now() + and not exists ( + select 1 + from recorded r, events re + where r.eventuid = re.eventuid + and lower(e.title) = lower(re.title) + and coalesce(lower(e.subtitle), '') = coalesce(lower(re.subtitle), '') + and ts_rank(to_tsvector(e.description), plainto_tsquery(re.description)) + + ts_rank(to_tsvector(re.description), plainto_tsquery(e.description)) > 1)) e +where e.schedulerank = 1 +order by e.priority desc, e.what, e.transportstreamid, e.starttime + -- cgit v1.2.3