From 56285bb19f3820a33a06f9b1cb51cd913470167a Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 3 Jan 2016 21:41:43 +0000 Subject: Use icetray tools for SQL embedding --- mythfs/service/Jamfile.jam | 24 ++---------------------- mythfs/service/dbimpl.cpp | 8 ++++---- mythfs/service/dbimpl.h | 7 +++---- mythfs/service/embed.cpp.m4 | 12 ------------ mythfs/service/embed.h.m4 | 12 ------------ 5 files changed, 9 insertions(+), 54 deletions(-) delete mode 100644 mythfs/service/embed.cpp.m4 delete mode 100644 mythfs/service/embed.h.m4 diff --git a/mythfs/service/Jamfile.jam b/mythfs/service/Jamfile.jam index aa79386..7dc26cb 100644 --- a/mythfs/service/Jamfile.jam +++ b/mythfs/service/Jamfile.jam @@ -1,5 +1,4 @@ -import generators ; -import type ; +import icetray ; lib mythfs : [ glob *.cpp *.ice sql/*.sql ] @@ -18,29 +17,10 @@ lib mythfs : ..//slicer ..//slicer-db ../..//glibmm + MythFS : : . ..//netfsComms ..//icetray ; -path-constant root : . ; -type.register SQL : sql ; -type.register HEX : hex ; -generators.register-standard sql.embed.hex : SQL : HEX ; -generators.register-standard sql.embed : HEX : CPP H ; - -actions sql.embed -{ - m4 -DNAME="$(2[1]:B)" "$(root)/embed.h.m4" > "$(1[2])" - m4 -DNAME="$(2[1]:B)" "$(root)/embed.cpp.m4" > "$(1[1])" -} - -actions sql.embed.hex -{ - xxd -i "$(2)" - | grep , > "$(1[1])" -} - -IMPORT $(__name__) : sql.embed : : sql.embed ; -IMPORT $(__name__) : sql.embed.hex : : sql.embed.hex ; - diff --git a/mythfs/service/dbimpl.cpp b/mythfs/service/dbimpl.cpp index 4a53790..742c3e8 100644 --- a/mythfs/service/dbimpl.cpp +++ b/mythfs/service/dbimpl.cpp @@ -1,16 +1,16 @@ #include "dbimpl.h" -#include +#include namespace MythFS { - DBImpl::DBImpl(boost::shared_ptr> d) : - IceTray::AbstractDatabaseClient(d) + DBImpl::DBImpl(IceTray::DatabasePoolPtr d) : + IceTray::AbstractCachingDatabaseClient(d) { } Recordeds DBImpl::getRecorded(const Ice::Current &) { - return fetch(); + return fetchCache(10); } } diff --git a/mythfs/service/dbimpl.h b/mythfs/service/dbimpl.h index 429d921..6726826 100644 --- a/mythfs/service/dbimpl.h +++ b/mythfs/service/dbimpl.h @@ -2,13 +2,12 @@ #define MYTHFS_DB_H #include -#include -#include +#include namespace MythFS { - class DBImpl : public DB, ::IceTray::AbstractDatabaseClient { + class DBImpl : public DB, ::IceTray::AbstractCachingDatabaseClient { public: - DBImpl(boost::shared_ptr>); + DBImpl(IceTray::DatabasePoolPtr); Recordeds getRecorded(const Ice::Current &); }; diff --git a/mythfs/service/embed.cpp.m4 b/mythfs/service/embed.cpp.m4 deleted file mode 100644 index 43901dd..0000000 --- a/mythfs/service/embed.cpp.m4 +++ /dev/null @@ -1,12 +0,0 @@ -define(`name', NAME) -define(`incl', `#include "'NAME`.h"') -define(`inclhex', `#include "'NAME`.hex"') -incl - -namespace sql { - const std::string name::sql({ - inclhex - , 0x00}); - const std::size_t name::hash(std::hash()(sql)); -} - diff --git a/mythfs/service/embed.h.m4 b/mythfs/service/embed.h.m4 deleted file mode 100644 index a08a1c5..0000000 --- a/mythfs/service/embed.h.m4 +++ /dev/null @@ -1,12 +0,0 @@ -define(`name', NAME) -#include -#include - -namespace sql { - class name { - public: - static const std::string sql; - static const std::size_t hash; - }; -} - -- cgit v1.2.3