summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2016-06-03 02:36:45 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2016-06-03 02:36:45 +0100
commitf2c4ee83aed05a75a994d687f661523b2018a98c (patch)
treea0c93ddfd9cf82f9e4d7c0cd7e8cf0545d704d39
parentBulk merge ebuild archs (diff)
downloadgentoobrowse-api-f2c4ee83aed05a75a994d687f661523b2018a98c.tar.bz2
gentoobrowse-api-f2c4ee83aed05a75a994d687f661523b2018a98c.tar.xz
gentoobrowse-api-f2c4ee83aed05a75a994d687f661523b2018a98c.zip
Use entity where filter's entity ids directly
-rw-r--r--gentoobrowse-api/service/maintenance/ebuildMetaProcessor.cpp18
-rw-r--r--gentoobrowse-api/service/maintenance/ebuildMetaProcessor.h5
2 files changed, 14 insertions, 9 deletions
diff --git a/gentoobrowse-api/service/maintenance/ebuildMetaProcessor.cpp b/gentoobrowse-api/service/maintenance/ebuildMetaProcessor.cpp
index a57c674..4b77a31 100644
--- a/gentoobrowse-api/service/maintenance/ebuildMetaProcessor.cpp
+++ b/gentoobrowse-api/service/maintenance/ebuildMetaProcessor.cpp
@@ -11,7 +11,6 @@
#include "utils/fileUtils.h"
#include "utils/dbUtils.h"
#include "utils/ebuildCacheParser.h"
-#include "utils/entityWhereFilter.h"
#include "utils/splitEbuildProps.h"
#include <sql/maintenance/categoryInsert.sql.h>
#include <sql/maintenance/packageInsert.sql.h>
@@ -36,6 +35,11 @@ namespace Gentoo {
const int EbuildMetaProcessor::FILETYPEID = 1;
+ EbuildMetaProcessor::EbuildMetaProcessor() :
+ ebuildIds("ebuildId")
+ {
+ }
+
void
EbuildMetaProcessor::created(DB::Connection * dbc, const boost::filesystem::path & fn, const boost::filesystem::path & path)
{
@@ -127,14 +131,13 @@ namespace Gentoo {
void
EbuildMetaProcessor::apply(DB::Connection * dbc)
{
- if (!ebuildIds.empty()) {
- U::EntityWhereFilter ewf("ebuildId", ebuildIds);
+ if (!ebuildIds.entityIds.empty()) {
{
dbc->execute("CREATE INDEX idxTmpEbuildDeps ON tmpEbuildDeps(ebuildId, runtime)");
DB::TablePatch t;
t.pk = { "ebuildid", "packageid", "versionspec", "flags", "slot", "op" };
t.cols = { "ebuildid", "packageid", "versionspec", "flags", "slot", "op" };
- t.where = &ewf;
+ t.where = &ebuildIds;
DB::StaticSqlWriter sb(sql::maintenance::ebuildDeps.getSql());
t.srcExpr = &sb;
@@ -153,7 +156,7 @@ namespace Gentoo {
t.dest = "gentoobrowse.ebuild_uses";
t.pk = { "ebuildid", "use" };
t.cols = { "ebuildid", "use" };
- t.where = &ewf;
+ t.where = &ebuildIds;
dbc->patchTable(&t);
}
{
@@ -163,7 +166,7 @@ namespace Gentoo {
t.dest = "gentoobrowse.ebuild_archs";
t.pk = { "ebuildid", "arch" };
t.cols = { "ebuildid", "arch" };
- t.where = &ewf;
+ t.where = &ebuildIds;
dbc->patchTable(&t);
}
}
@@ -193,7 +196,7 @@ namespace Gentoo {
void
EbuildMetaProcessor::perEbuildUpdates(DB::Connection * dbc, const U::EbuildCacheParser & ecp, int64_t ebuildId, bool newest, int64_t packageId)
{
- U::EntityWhereFilter ewf("ebuildId", ebuildId);
+ ebuildIds.entityIds.insert(ebuildId);
// IUSE
if (auto uses = ecp.get("IUSE")) {
useInsert->bindParamI(0, ebuildId);
@@ -207,7 +210,6 @@ namespace Gentoo {
archInsert->execute();
}
// Dependencies
- ebuildIds.insert(ebuildId);
depInsert->bindParamI(1, ebuildId);
if (auto depend = ecp.getRange("DEPEND")) {
depInsert->bindParamB(5, false);
diff --git a/gentoobrowse-api/service/maintenance/ebuildMetaProcessor.h b/gentoobrowse-api/service/maintenance/ebuildMetaProcessor.h
index f4d4b07..6d597cb 100644
--- a/gentoobrowse-api/service/maintenance/ebuildMetaProcessor.h
+++ b/gentoobrowse-api/service/maintenance/ebuildMetaProcessor.h
@@ -7,6 +7,7 @@
#include <connection.h>
#include <modifycommand.h>
#include <boost/filesystem/path.hpp>
+#include "utils/entityWhereFilter.h"
namespace Gentoo {
namespace Service {
@@ -14,6 +15,8 @@ namespace Gentoo {
public:
static const int FILETYPEID;
+ EbuildMetaProcessor();
+
void created(DB::Connection * dbc, const boost::filesystem::path & fn, const boost::filesystem::path & path) override;
void modified(DB::Connection * dbc, const boost::filesystem::path & fn, const boost::filesystem::path & path) override;
void deleted(DB::Connection * dbc, const boost::filesystem::path & fn) override;
@@ -29,7 +32,7 @@ namespace Gentoo {
DB::ModifyCommandPtr depInsert;
DB::ModifyCommandPtr useInsert;
DB::ModifyCommandPtr archInsert;
- std::set<int64_t> ebuildIds;
+ Utils::EntityWhereFilter ebuildIds;
std::set<std::string> catsDeleteFrom;
};
}