summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gentoobrowse-api/service/maintenance/ebuildMetaProcessor.cpp21
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" };