diff options
-rw-r--r-- | gentoobrowse-api/service/maintenance/ebuildMetaProcessor.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/gentoobrowse-api/service/maintenance/ebuildMetaProcessor.cpp b/gentoobrowse-api/service/maintenance/ebuildMetaProcessor.cpp index 48bd6cc..87cfd12 100644 --- a/gentoobrowse-api/service/maintenance/ebuildMetaProcessor.cpp +++ b/gentoobrowse-api/service/maintenance/ebuildMetaProcessor.cpp @@ -149,28 +149,33 @@ namespace Gentoo { } } - class EbuildWhereFilter : public DB::SqlWriter { + class EntityWhereFilter : public DB::SqlWriter { public: - EbuildWhereFilter(int64_t e) : ebuildId(e) { } + EntityWhereFilter(const std::string & en, int64_t e) : + entityId(e), + entityColName(en) + { + } void writeSql(AdHoc::Buffer & sql) override { - sql.append("b.ebuildId = ?"); + sql.appendbf("b.%s = ?", entityColName); } void bindParams(DB::Command * c, unsigned int & offset) override { - c->bindParamI(offset++, ebuildId); + c->bindParamI(offset++, entityId); } - const int64_t ebuildId; + const int64_t entityId; + const std::string entityColName; }; void EbuildMetaProcessor::perEbuildUpdates(DB::Connection * dbc, const EbuildCacheParser & ecp, int64_t ebuildId) const { - EbuildWhereFilter ewf(ebuildId); - // USE flags + EntityWhereFilter ewf("ebuildId", ebuildId); + // IUSE DB::TablePatch t; SplitEbuildProps sep_use("ebuildId", ebuildId, "use", ecp.get("IUSE")); t.dest = "gentoobrowse.ebuild_uses"; |