summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2016-01-03 21:32:20 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2016-01-03 21:32:20 +0000
commitaa308e127902572f324f6eca7030b0eeb442e915 (patch)
tree08a9c0992e717105d3844a31b99a45c5ef412795
parentRe-namespace service (diff)
downloadgentoobrowse-api-aa308e127902572f324f6eca7030b0eeb442e915.tar.bz2
gentoobrowse-api-aa308e127902572f324f6eca7030b0eeb442e915.tar.xz
gentoobrowse-api-aa308e127902572f324f6eca7030b0eeb442e915.zip
Use icetray tools for SQL embedding
-rw-r--r--gentoobrowse-api/service/Jamfile.jam24
-rw-r--r--gentoobrowse-api/service/embed.cpp.m412
-rw-r--r--gentoobrowse-api/service/embed.h.m412
-rw-r--r--gentoobrowse-api/service/portageimpl.cpp68
4 files changed, 36 insertions, 80 deletions
diff --git a/gentoobrowse-api/service/Jamfile.jam b/gentoobrowse-api/service/Jamfile.jam
index 946da69..5bad606 100644
--- a/gentoobrowse-api/service/Jamfile.jam
+++ b/gentoobrowse-api/service/Jamfile.jam
@@ -1,6 +1,5 @@
-import generators ;
-import type ;
import lex ;
+import icetray ;
lib icetray : : : : <include>/usr/include/icetray ;
@@ -23,6 +22,7 @@ lib gentoobrowse-service :
<library>..//boost_thread
<library>..//boost_date_time
<library>../..//glibmm
+ <icetray.sql.namespace>Gentoo::Service
<include>.
: :
<include>.
@@ -30,23 +30,3 @@ lib gentoobrowse-service :
<library>../api//gentoobrowse-api
;
-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/gentoobrowse-api/service/embed.cpp.m4 b/gentoobrowse-api/service/embed.cpp.m4
deleted file mode 100644
index 43901dd..0000000
--- a/gentoobrowse-api/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/gentoobrowse-api/service/embed.h.m4 b/gentoobrowse-api/service/embed.h.m4
deleted file mode 100644
index a08a1c5..0000000
--- a/gentoobrowse-api/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;
- };
-}
-
diff --git a/gentoobrowse-api/service/portageimpl.cpp b/gentoobrowse-api/service/portageimpl.cpp
index a3f499e..99af5f8 100644
--- a/gentoobrowse-api/service/portageimpl.cpp
+++ b/gentoobrowse-api/service/portageimpl.cpp
@@ -1,21 +1,21 @@
#include "portageimpl.h"
-#include <sql/portage/getCategory.h>
-#include <sql/portage/getAllCategories.h>
-#include <sql/portage/getCategoriesInSuper.h>
-#include <sql/portage/getOverviewCategoriesInSuper.h>
-#include <sql/portage/getPackage.h>
-#include <sql/portage/findPackage.h>
-#include <sql/portage/getPackagesInCategory.h>
-#include <sql/portage/getPackagesSearch.h>
-#include <sql/portage/getPackageVersions.h>
-#include <sql/portage/getPackageChangeLog.h>
-#include <sql/portage/getRecentAdditions.h>
-#include <sql/portage/getBug.h>
-#include <sql/portage/getPackageBugs.h>
-#include <sql/portage/getBugsSearch.h>
-#include <sql/portage/getNewsItem.h>
-#include <sql/portage/getNewsSearch.h>
-#include <sql/portage/getNewsRecent.h>
+#include <sql/portage/getCategory.sql.h>
+#include <sql/portage/getAllCategories.sql.h>
+#include <sql/portage/getCategoriesInSuper.sql.h>
+#include <sql/portage/getOverviewCategoriesInSuper.sql.h>
+#include <sql/portage/getPackage.sql.h>
+#include <sql/portage/findPackage.sql.h>
+#include <sql/portage/getPackagesInCategory.sql.h>
+#include <sql/portage/getPackagesSearch.sql.h>
+#include <sql/portage/getPackageVersions.sql.h>
+#include <sql/portage/getPackageChangeLog.sql.h>
+#include <sql/portage/getRecentAdditions.sql.h>
+#include <sql/portage/getBug.sql.h>
+#include <sql/portage/getPackageBugs.sql.h>
+#include <sql/portage/getBugsSearch.sql.h>
+#include <sql/portage/getNewsItem.sql.h>
+#include <sql/portage/getNewsSearch.sql.h>
+#include <sql/portage/getNewsRecent.sql.h>
namespace Gentoo {
namespace Service {
@@ -27,103 +27,103 @@ Portage::Portage(boost::shared_ptr<AdHoc::ResourcePool<DB::Connection>> d) :
Gentoo::CategoryPtr
Portage::getCategory(Ice::Int id, const Ice::Current &)
{
- return fetch<Gentoo::CategoryPtr, sql::getCategory>(id);
+ return fetch<Gentoo::CategoryPtr, sql::portage::getCategory>(id);
}
Gentoo::Categories
Portage::getAllCategories(const Ice::Current &)
{
- return fetch<Gentoo::Categories, sql::getAllCategories>();
+ return fetch<Gentoo::Categories, sql::portage::getAllCategories>();
}
Gentoo::Categories
Portage::getCategoriesInSuper(const std::string & super, const Ice::Current &)
{
- return fetch<Gentoo::Categories, sql::getCategoriesInSuper>(super);
+ return fetch<Gentoo::Categories, sql::portage::getCategoriesInSuper>(super);
}
Gentoo::OverviewCategories
Portage::getOverviewCategoriesInSuper(const std::string & super, const Ice::Current &)
{
- return fetch<Gentoo::OverviewCategories, sql::getOverviewCategoriesInSuper>(super);
+ return fetch<Gentoo::OverviewCategories, sql::portage::getOverviewCategoriesInSuper>(super);
}
Gentoo::PackagePtr
Portage::getPackage(Ice::Int id, const Ice::Current &)
{
- return fetch<Gentoo::PackagePtr, sql::getPackage>(id);
+ return fetch<Gentoo::PackagePtr, sql::portage::getPackage>(id);
}
IceUtil::Optional<Gentoo::PackagePtr>
Portage::findPackage(const std::string & cat, const std::string & pkg, const Ice::Current &)
{
- return fetch<IceUtil::Optional<Gentoo::PackagePtr>, sql::findPackage>(cat, pkg);
+ return fetch<IceUtil::Optional<Gentoo::PackagePtr>, sql::portage::findPackage>(cat, pkg);
}
Gentoo::Packages
Portage::getPackagesInCategory(Ice::Int id, const Ice::Current &)
{
- return fetch<Gentoo::Packages, sql::getPackagesInCategory>(id);
+ return fetch<Gentoo::Packages, sql::portage::getPackagesInCategory>(id);
}
Gentoo::SearchResultPackages
Portage::getPackagesSearch(const std::string & query, const Ice::Current &)
{
- return fetch<Gentoo::SearchResultPackages, sql::getPackagesSearch>(query, query);
+ return fetch<Gentoo::SearchResultPackages, sql::portage::getPackagesSearch>(query, query);
}
Gentoo::Ebuilds
Portage::getPackageVersions(Ice::Int id, const Ice::Current &)
{
- return fetch<Gentoo::Ebuilds, sql::getPackageVersions>(id);
+ return fetch<Gentoo::Ebuilds, sql::portage::getPackageVersions>(id);
}
Gentoo::ChangeLog
Portage::getPackageChangeLog(Ice::Int id, const Ice::Current &)
{
- return fetch<Gentoo::ChangeLog, sql::getPackageChangeLog>(id);
+ return fetch<Gentoo::ChangeLog, sql::portage::getPackageChangeLog>(id);
}
Gentoo::Ebuilds
Portage::getRecentAdditions(Ice::Int syncs, const Ice::Current &)
{
- return fetch<Gentoo::Ebuilds, sql::getRecentAdditions>(syncs);
+ return fetch<Gentoo::Ebuilds, sql::portage::getRecentAdditions>(syncs);
}
Gentoo::BugPtr
Portage::getBug(Ice::Int id, const Ice::Current &)
{
- return fetch<Gentoo::BugPtr, sql::getBug>(id);
+ return fetch<Gentoo::BugPtr, sql::portage::getBug>(id);
}
Gentoo::Bugs
Portage::getPackageBugs(Ice::Int packageId, const Ice::Current &)
{
- return fetch<Gentoo::Bugs, sql::getPackageBugs>(packageId);
+ return fetch<Gentoo::Bugs, sql::portage::getPackageBugs>(packageId);
}
Gentoo::SearchResultBugs
Portage::getBugsSearch(const std::string & query, const Ice::Current &)
{
- return fetch<Gentoo::SearchResultBugs, sql::getBugsSearch>(query, query);
+ return fetch<Gentoo::SearchResultBugs, sql::portage::getBugsSearch>(query, query);
}
Gentoo::NewsItemPtr
Portage::getNewsItem(const std::string & id, const Ice::Current &)
{
- return fetch<Gentoo::NewsItemPtr, sql::getNewsItem>(id);
+ return fetch<Gentoo::NewsItemPtr, sql::portage::getNewsItem>(id);
}
Gentoo::News
Portage::getNewsSearch(const std::string & query, const Ice::Current &)
{
- return fetch<Gentoo::News, sql::getNewsSearch>(query);
+ return fetch<Gentoo::News, sql::portage::getNewsSearch>(query);
}
Gentoo::News
Portage::getNewsRecent(Ice::Int items, const Ice::Current &)
{
- return fetch<Gentoo::News, sql::getNewsRecent>(items);
+ return fetch<Gentoo::News, sql::portage::getNewsRecent>(items);
}
}
}