summaryrefslogtreecommitdiff
path: root/p2pvr/daemon/si.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'p2pvr/daemon/si.cpp')
-rw-r--r--p2pvr/daemon/si.cpp103
1 files changed, 46 insertions, 57 deletions
diff --git a/p2pvr/daemon/si.cpp b/p2pvr/daemon/si.cpp
index bee7fa7..f8a49be 100644
--- a/p2pvr/daemon/si.cpp
+++ b/p2pvr/daemon/si.cpp
@@ -21,47 +21,48 @@
#include "sql/si/eventsInRange.sql.h"
#include "sql/si/eventSearch.sql.h"
-IceTray::Logging::LoggerPtr SI::logger(LOGMANAGER()->getLogger<SI>());
+namespace P2PVR {
+IceTray::Logging::LoggerPtr SII::logger(LOGMANAGER()->getLogger<SII>());
-SI::SI(IceTray::DatabasePoolPtr db) :
+SII::SII(IceTray::DatabasePoolPtr db) :
IceTray::AbstractDatabaseClient(db)
{
}
DVBSI::Networks
-SI::GetNetworks(const Ice::Current &)
+SII::GetNetworks(const Ice::Current &)
{
logger->message(LOG::DEBUG, __PRETTY_FUNCTION__);
- return fetch<DVBSI::Networks>(P2PVR::sql::si::allNetworks);
+ return fetch<DVBSI::Networks>(sql::si::allNetworks);
}
-P2PVR::Deliveries
-SI::GetAllDeliveries(const Ice::Current &)
+Deliveries
+SII::GetAllDeliveries(const Ice::Current &)
{
logger->message(LOG::DEBUG, __PRETTY_FUNCTION__);
- auto rtn = fetch<P2PVR::Deliveries>("delivery_type", P2PVR::sql::si::allDeliveries);
+ auto rtn = fetch<Deliveries>("delivery_type", sql::si::allDeliveries);
logger->messagebf(LOG::DEBUG, "%s: Found %d delivery methods", __PRETTY_FUNCTION__, rtn.size());
return rtn;
}
DVBSI::DeliveryPtr
-SI::GetDeliveryForTransport(int id, const Ice::Current&)
+SII::GetDeliveryForTransport(int id, const Ice::Current&)
{
try {
logger->messagef(LOG::DEBUG, "%s(%d)", __PRETTY_FUNCTION__, id);
- return fetch<DVBSI::DeliveryPtr>("delivery_type", P2PVR::sql::si::deliveryForTransport, id);
+ return fetch<DVBSI::DeliveryPtr>("delivery_type", sql::si::deliveryForTransport, id);
}
catch (const Slicer::NoRowsReturned &) {
- throw P2PVR::NotFound();
+ throw NotFound();
}
}
DVBSI::DeliveryPtr
-SI::GetDeliveryForSi(const Ice::Current&)
+SII::GetDeliveryForSi(const Ice::Current&)
{
try {
logger->message(LOG::DEBUG, __PRETTY_FUNCTION__);
- return fetch<DVBSI::DeliveryPtr>("delivery_type", P2PVR::sql::si::serviceNextUsed);
+ return fetch<DVBSI::DeliveryPtr>("delivery_type", sql::si::serviceNextUsed);
}
catch (const Slicer::NoRowsReturned &) {
return NULL;
@@ -69,101 +70,89 @@ SI::GetDeliveryForSi(const Ice::Current&)
}
DVBSI::DeliveryPtr
-SI::GetDeliveryForService(int id, const Ice::Current&)
+SII::GetDeliveryForService(int id, const Ice::Current&)
{
try {
logger->messagef(LOG::DEBUG, "%s(%d)", __PRETTY_FUNCTION__, id);
- return fetch<DVBSI::DeliveryPtr>("delivery_type", P2PVR::sql::si::deliveryForService, id);
+ return fetch<DVBSI::DeliveryPtr>("delivery_type", sql::si::deliveryForService, id);
}
catch (const Slicer::NoRowsReturned &) {
- throw P2PVR::NotFound();
+ throw NotFound();
}
}
DVBSI::ServiceList
-SI::GetServices(const Ice::Current&)
+SII::GetServices(const Ice::Current&)
{
logger->message(LOG::DEBUG, __PRETTY_FUNCTION__);
- return fetch<DVBSI::ServiceList>(P2PVR::sql::si::servicesSelectAll);
+ return fetch<DVBSI::ServiceList>(sql::si::servicesSelectAll);
}
DVBSI::ServicePtr
-SI::GetService(int id, const Ice::Current&)
+SII::GetService(int id, const Ice::Current&)
{
logger->messagef(LOG::DEBUG, "%s(%d)", __PRETTY_FUNCTION__, id);
- auto rtn = fetch<DVBSI::ServiceList>(P2PVR::sql::si::servicesSelectById, id);
- if (rtn.empty()) throw P2PVR::NotFound();
+ auto rtn = fetch<DVBSI::ServiceList>(sql::si::servicesSelectById, id);
+ if (rtn.empty()) throw NotFound();
return rtn.front();
}
-P2PVR::Events
-SI::GetEvents(const P2PVR::IntSequence & eventUids, const Ice::Current &)
+Events
+SII::GetEvents(const IntSequence & eventUids, const Ice::Current &)
{
logger->message(LOG::DEBUG, __PRETTY_FUNCTION__);
- P2PVR::Events rtn;
+ Events rtn;
for (const auto & uid : eventUids) {
- auto list = fetch<P2PVR::Events>(P2PVR::sql::si::eventByUid, uid);
+ auto list = fetch<Events>(sql::si::eventByUid, uid);
std::copy(list.begin(), list.end(), std::back_inserter(rtn));
}
- if (rtn.size() != eventUids.size()) throw P2PVR::NotFound();
+ if (rtn.size() != eventUids.size()) throw NotFound();
return rtn;
}
-P2PVR::EventPtr
-SI::GetEvent(int serviceId, int eventId, const Ice::Current &)
+EventPtr
+SII::GetEvent(int serviceId, int eventId, const Ice::Current &)
{
logger->messagef(LOG::DEBUG, "%s(s=%d, e=%d)", __PRETTY_FUNCTION__, serviceId, eventId);
- auto rtn = fetch<P2PVR::Events>(P2PVR::sql::si::eventById, serviceId, eventId);
- if (rtn.empty()) throw P2PVR::NotFound();
+ auto rtn = fetch<Events>(sql::si::eventById, serviceId, eventId);
+ if (rtn.empty()) throw NotFound();
return rtn.front();
}
-P2PVR::Events
-SI::EventsOnNow(const Ice::Current &)
+Events
+SII::EventsOnNow(const Ice::Current &)
{
logger->message(LOG::DEBUG, __PRETTY_FUNCTION__);
- return fetch<P2PVR::Events>(P2PVR::sql::si::eventsOnNow);
+ return fetch<Events>(sql::si::eventsOnNow);
}
-namespace IceTray {
- template<>
- void
- AbstractDatabaseClient::bind1<Common::DateTime>(int x, DB::Command * cmd, const Common::DateTime &);
-}
-
-template<>
-void
-IceTray::AbstractDatabaseClient::bind1<Common::DateTime>(int x, DB::Command * cmd, const Common::DateTime & dt)
-{
- cmd->bindParamT(x, *dt);
-}
-
-P2PVR::Events
-SI::EventsInRange(const Common::DateTime & from, const Common::DateTime & to, const Ice::Current &)
+Events
+SII::EventsInRange(const Common::DateTime & from, const Common::DateTime & to, const Ice::Current &)
{
logger->messagebf(LOG::DEBUG, "%s([%s]-[%s])", from, to, __PRETTY_FUNCTION__);
- return fetch<P2PVR::Events>(P2PVR::sql::si::eventsInRange, from, to);
+ return fetch<Events>(sql::si::eventsInRange, from, to);
}
-P2PVR::Events
-SI::EventSearch(const IceUtil::Optional<std::string> & keywords, const IceUtil::Optional<Ice::Int> & serviceId, const IceUtil::Optional<Common::DateTime> & from, const IceUtil::Optional<Common::DateTime> & to, const Ice::Current &)
+Events
+SII::EventSearch(const IceUtil::Optional<std::string> & keywords, const IceUtil::Optional<Ice::Int> & serviceId, const IceUtil::Optional<Common::DateTime> & from, const IceUtil::Optional<Common::DateTime> & to, const Ice::Current &)
{
logger->messagebf(LOG::DEBUG, "%s(keywords=%s,serviceId=%s,from=%s,to=%s)",
keywords, serviceId, from, to, __PRETTY_FUNCTION__);
- return fetch<P2PVR::Events>(P2PVR::sql::si::eventSearch, from, to, serviceId, serviceId, keywords, keywords, keywords, keywords);
+ return fetch<Events>(sql::si::eventSearch, from, to, serviceId, serviceId, keywords, keywords, keywords, keywords);
}
-P2PVR::Events
-SI::EventsInSchedules(const Ice::Current &)
+Events
+SII::EventsInSchedules(const Ice::Current &)
{
logger->message(LOG::DEBUG, __PRETTY_FUNCTION__);
- return fetch<P2PVR::Events>(P2PVR::sql::si::eventsInSchedules);
+ return fetch<Events>(sql::si::eventsInSchedules);
}
-P2PVR::Events
-SI::EventsInSchedule(int scheduleId, const Ice::Current &)
+Events
+SII::EventsInSchedule(int scheduleId, const Ice::Current &)
{
logger->messagebf(LOG::DEBUG, "%s(%d)", scheduleId, __PRETTY_FUNCTION__);
- return fetch<P2PVR::Events>(P2PVR::sql::si::eventsInSchedule, scheduleId);
+ return fetch<Events>(sql::si::eventsInSchedule, scheduleId);
+}
}