summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2015-01-17 02:28:24 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2015-06-13 17:29:47 +0100
commitb94e671198015f88b90b08f29d112ad70e614127 (patch)
tree02fa67454e62298152f826126c98a470b985bf82
parentAdd duration conversions (diff)
downloadp2pvr-b94e671198015f88b90b08f29d112ad70e614127.tar.bz2
p2pvr-b94e671198015f88b90b08f29d112ad70e614127.tar.xz
p2pvr-b94e671198015f88b90b08f29d112ad70e614127.zip
Migrate schedules impl to SQL deserializer
-rw-r--r--p2pvr/daemon/schedules.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/p2pvr/daemon/schedules.cpp b/p2pvr/daemon/schedules.cpp
index f70d44d..dfd7220 100644
--- a/p2pvr/daemon/schedules.cpp
+++ b/p2pvr/daemon/schedules.cpp
@@ -11,6 +11,8 @@
#include "resources.h"
#include <boost/date_time/posix_time/posix_time.hpp>
#include <instanceStore.impl.h>
+#include "sqlSelectDeserializer.h"
+#include <slicer/slicer.h>
ResourceString(Schedules_getCandidates, sql_Schedules_getCandidates);
ResourceString(Schedules_insert, sql_Schedules_insert);
@@ -431,18 +433,17 @@ Schedules::DeleteSchedule(int id, const Ice::Current & ice)
P2PVR::ScheduleList
Schedules::GetSchedules(const Ice::Current &)
{
- P2PVR::ScheduleList schedules;
- SqlContainerCreator<P2PVR::ScheduleList, P2PVR::Schedule> cct(schedules);
- cct.populate(Select(Schedules_selectAll).second);
- return schedules;
+ Logger()->message(LOG_DEBUG, __PRETTY_FUNCTION__);
+ return Slicer::DeserializeAny<SqlSelectDeserializer, P2PVR::ScheduleList>(
+ *Select(Schedules_selectAll).second);
}
P2PVR::SchedulePtr
Schedules::GetSchedule(int id, const Ice::Current &)
{
- P2PVR::ScheduleList schedules;
- SqlContainerCreator<P2PVR::ScheduleList, P2PVR::Schedule> cct(schedules);
- cct.populate(Select(Schedules_selectById, id).second);
+ Logger()->messagebf(LOG_DEBUG, "%s(%d)", __PRETTY_FUNCTION__, id);
+ auto schedules = Slicer::DeserializeAny<SqlSelectDeserializer, P2PVR::ScheduleList>(
+ *Select(Schedules_selectById, id).second);
if (schedules.empty()) throw P2PVR::NotFound();
return schedules.front();
}
@@ -450,10 +451,9 @@ Schedules::GetSchedule(int id, const Ice::Current &)
P2PVR::ScheduledToRecordList
Schedules::GetScheduledToRecord(const Ice::Current &)
{
- P2PVR::ScheduledToRecordList scheduled;
- SqlContainerCreator<P2PVR::ScheduledToRecordList, P2PVR::ScheduledToRecord> cct(scheduled);
- cct.populate(Select(Schedules_scheduledToRecord).second);
- return scheduled;
+ Logger()->message(LOG_DEBUG, __PRETTY_FUNCTION__);
+ return Slicer::DeserializeAny<SqlSelectDeserializer, P2PVR::ScheduledToRecordList>(
+ *Select(Schedules_scheduledToRecord).second);
}
int