summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2016-01-03 21:41:43 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2016-01-03 21:41:43 +0000
commit56285bb19f3820a33a06f9b1cb51cd913470167a (patch)
tree4d5671214b1963fd51f23163a4dffe1b55a3ac20
parentCompatibility with libdbpp-*-1 (diff)
downloadmythfs-56285bb19f3820a33a06f9b1cb51cd913470167a.tar.bz2
mythfs-56285bb19f3820a33a06f9b1cb51cd913470167a.tar.xz
mythfs-56285bb19f3820a33a06f9b1cb51cd913470167a.zip
Use icetray tools for SQL embedding
-rw-r--r--mythfs/service/Jamfile.jam24
-rw-r--r--mythfs/service/dbimpl.cpp8
-rw-r--r--mythfs/service/dbimpl.h7
-rw-r--r--mythfs/service/embed.cpp.m412
-rw-r--r--mythfs/service/embed.h.m412
5 files changed, 9 insertions, 54 deletions
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 :
<library>..//slicer
<library>..//slicer-db
<library>../..//glibmm
+ <icetray.sql.namespace>MythFS
: :
<include>.
<library>..//netfsComms
<library>..//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 <sql/getRecorded.h>
+#include <sql/getRecorded.sql.h>
namespace MythFS {
- DBImpl::DBImpl(boost::shared_ptr<AdHoc::ResourcePool<::DB::Connection>> d) :
- IceTray::AbstractDatabaseClient(d)
+ DBImpl::DBImpl(IceTray::DatabasePoolPtr d) :
+ IceTray::AbstractCachingDatabaseClient(d)
{
}
Recordeds
DBImpl::getRecorded(const Ice::Current &)
{
- return fetch<Recordeds, sql::getRecorded>();
+ return fetchCache<Recordeds, sql::getRecorded>(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 <myth-db.h>
-#include <abstractDatabaseClient.h>
-#include <connectionPool.h>
+#include <abstractCachingDatabaseClient.h>
namespace MythFS {
- class DBImpl : public DB, ::IceTray::AbstractDatabaseClient {
+ class DBImpl : public DB, ::IceTray::AbstractCachingDatabaseClient {
public:
- DBImpl(boost::shared_ptr<AdHoc::ResourcePool<::DB::Connection>>);
+ 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<std::string>()(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 <functional>
-#include <string>
-
-namespace sql {
- class name {
- public:
- static const std::string sql;
- static const std::size_t hash;
- };
-}
-