diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2016-04-25 00:56:36 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2016-04-25 21:37:39 +0100 |
commit | 4b44b05b147c4eadcdea063f7eb2628165a4cd9c (patch) | |
tree | bfa0605b6cfedc4b8f6e2e410e227bf9232b01aa | |
parent | Include flag indicating if ebuild is highest version of package (diff) | |
download | gentoobrowse-api-4b44b05b147c4eadcdea063f7eb2628165a4cd9c.tar.bz2 gentoobrowse-api-4b44b05b147c4eadcdea063f7eb2628165a4cd9c.tar.xz gentoobrowse-api-4b44b05b147c4eadcdea063f7eb2628165a4cd9c.zip |
Generic split ebuild props
-rw-r--r-- | gentoobrowse-api/service/maintenance/ebuildMetaProcessor.cpp | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/gentoobrowse-api/service/maintenance/ebuildMetaProcessor.cpp b/gentoobrowse-api/service/maintenance/ebuildMetaProcessor.cpp index 3a6e409..48bd6cc 100644 --- a/gentoobrowse-api/service/maintenance/ebuildMetaProcessor.cpp +++ b/gentoobrowse-api/service/maintenance/ebuildMetaProcessor.cpp @@ -60,26 +60,27 @@ namespace Gentoo { class SplitEbuildProps : public DB::SqlWriter { public: - SplitEbuildProps(int e, const std::string & c, const boost::optional<Glib::ustring> & p) : - ebuildId(e), - colName(c), + SplitEbuildProps(const std::string & ce, int e, const std::string & cp, const boost::optional<Glib::ustring> & p) : + entityId(e), + colEntityName(ce), + colPropName(cp), props(p) { } void writeSql(AdHoc::Buffer & sql) override { - sql.appendbf("(SELECT DISTINCT ?::int ebuildId, trim(regexp_split_to_table(?, '\\s+'), '+') %s)", colName); + sql.appendbf("(SELECT DISTINCT ?::int %s, trim(regexp_split_to_table(?, '\\s+'), '+') %s)", colEntityName, colPropName); } void bindParams(DB::Command * c, unsigned int & offset) override { - c->bindParamI(offset++, ebuildId); + c->bindParamI(offset++, entityId); Utils::Database::bindOptionalsS(c, offset++, { props }); } - const int ebuildId; - const std::string colName; + const int entityId; + const std::string colEntityName, colPropName; const boost::optional<Glib::ustring> props; }; @@ -171,15 +172,15 @@ namespace Gentoo { EbuildWhereFilter ewf(ebuildId); // USE flags DB::TablePatch t; - SplitEbuildProps sep_use(ebuildId, "use", ecp.get("IUSE")); + SplitEbuildProps sep_use("ebuildId", ebuildId, "use", ecp.get("IUSE")); t.dest = "gentoobrowse.ebuild_uses"; t.srcExpr = &sep_use; t.pk = { "ebuildid", "use" }; t.cols = { "ebuildid", "use" }; t.where = &ewf; dbc->patchTable(&t); - // USE flags - SplitEbuildProps sep_keywords(ebuildId, "arch", ecp.get("KEYWORDS")); + // KEYWORDS + SplitEbuildProps sep_keywords("ebuildId", ebuildId, "arch", ecp.get("KEYWORDS")); t.dest = "gentoobrowse.ebuild_archs"; t.srcExpr = &sep_keywords; t.pk = { "ebuildid", "arch" }; |