summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2015-01-17 01:44:03 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2015-06-13 17:29:46 +0100
commit45f8d60fb9c715cd1e088de2e06f60863641341c (patch)
tree64e8ca9ea655521add8c1b94c4dfe55ff4c57391
parentMigrate SI impl to SQL deserializer (includes interface change as get all del... (diff)
downloadp2pvr-45f8d60fb9c715cd1e088de2e06f60863641341c.tar.bz2
p2pvr-45f8d60fb9c715cd1e088de2e06f60863641341c.tar.xz
p2pvr-45f8d60fb9c715cd1e088de2e06f60863641341c.zip
Migrate recordings impl to SQL deserializer
-rw-r--r--p2pvr/daemon/recordings.cpp31
1 files changed, 5 insertions, 26 deletions
diff --git a/p2pvr/daemon/recordings.cpp b/p2pvr/daemon/recordings.cpp
index ceb89ba..e3e92a0 100644
--- a/p2pvr/daemon/recordings.cpp
+++ b/p2pvr/daemon/recordings.cpp
@@ -4,6 +4,8 @@
#include <Ice/Ice.h>
#include <logger.h>
#include "sqlContainerCreator.h"
+#include <slicer/slicer.h>
+#include "sqlSelectDeserializer.h"
ResourceString(Recording_Insert, sql_Recordings_insert);
ResourceString(Recording_InsertNewId, sql_Recordings_insertNewId);
@@ -11,28 +13,6 @@ ResourceString(Recording_Delete, sql_Recordings_delete);
ResourceString(Recording_GetStorage, sql_Recordings_getStorage);
ResourceString(Recording_GetAll, sql_Recordings_getAll);
-template<>
-void
-CreateColumns<P2PVR::RecordingPtr>(const ColumnCreator & cc)
-{
- cc("recordingid", true);
- cc("storageaddress", false);
- cc("guid", false);
- cc("scheduleid", false);
- cc("eventuid", false);
-}
-
-template<>
-void
-UnbindColumns(RowState & rs, const P2PVR::RecordingPtr & r)
-{
- rs.fields[0] >> r->RecordingId;
- rs.fields[1] >> r->StorageAddress;
- rs.fields[2] >> r->Guid;
- rs.fields[3] >> r->ScheduleId;
- rs.fields[4] >> r->EventUid;
-}
-
int
Recordings::NewRecording(const P2PVR::RecordingPtr & r, const Ice::Current &)
{
@@ -67,9 +47,8 @@ Recordings::DeleteRecording(int id, const Ice::Current & ice)
P2PVR::RecordingList
Recordings::GetRecordings(const Ice::Current &)
{
- P2PVR::RecordingList rtn;
- SqlContainerCreator<P2PVR::RecordingList, P2PVR::Recording> cc(rtn);
- cc.populate(Select(Recording_GetAll).second);
- return rtn;
+ Logger()->message(LOG_DEBUG, __PRETTY_FUNCTION__);
+ return Slicer::DeserializeAny<SqlSelectDeserializer, P2PVR::RecordingList>(
+ *Select(Recording_GetAll).second);
}