Shorten a stupidly long sql query name

This commit is contained in:
regnat 2021-06-21 16:28:06 +02:00
parent 1f3ff0d193
commit dcabb46124

View file

@ -59,8 +59,8 @@ struct LocalStore::State::Stmts {
SQLiteStmt QueryAllRealisedOutputs; SQLiteStmt QueryAllRealisedOutputs;
SQLiteStmt QueryPathFromHashPart; SQLiteStmt QueryPathFromHashPart;
SQLiteStmt QueryValidPaths; SQLiteStmt QueryValidPaths;
SQLiteStmt QueryRealisationRealisationReferences; SQLiteStmt QueryRealisationReferences;
SQLiteStmt AddRealisationRealisationReference; SQLiteStmt AddRealisationReference;
}; };
int getSchema(Path schemaPath) int getSchema(Path schemaPath)
@ -362,13 +362,13 @@ LocalStore::LocalStore(const Params & params)
where drvPath = ? where drvPath = ?
; ;
)"); )");
state->stmts->QueryRealisationRealisationReferences.create(state->db, state->stmts->QueryRealisationReferences.create(state->db,
R"( R"(
select drvPath, outputName from Realisations select drvPath, outputName from Realisations
join RealisationsRefs on realisationReference = Realisations.id join RealisationsRefs on realisationReference = Realisations.id
where referrer = ?; where referrer = ?;
)"); )");
state->stmts->AddRealisationRealisationReference.create(state->db, state->stmts->AddRealisationReference.create(state->db,
R"( R"(
insert or replace into RealisationsRefs (referrer, realisationReference) insert or replace into RealisationsRefs (referrer, realisationReference)
values ( values (
@ -719,7 +719,7 @@ void LocalStore::registerDrvOutput(const Realisation & info)
.exec(); .exec();
uint64_t myId = state->db.getLastInsertedRowId(); uint64_t myId = state->db.getLastInsertedRowId();
for (auto & [outputId, _] : info.dependentRealisations) { for (auto & [outputId, _] : info.dependentRealisations) {
state->stmts->AddRealisationRealisationReference state->stmts->AddRealisationReference
.use()(myId)(outputId.strHash())(outputId.outputName) .use()(myId)(outputId.strHash())(outputId.outputName)
.exec(); .exec();
} }
@ -1732,7 +1732,7 @@ std::optional<const Realisation> LocalStore::queryRealisation(
std::map<DrvOutput, StorePath> dependentRealisations; std::map<DrvOutput, StorePath> dependentRealisations;
auto useRealisationRefs( auto useRealisationRefs(
state->stmts->QueryRealisationRealisationReferences.use()( state->stmts->QueryRealisationReferences.use()(
realisationDbId)); realisationDbId));
while (useRealisationRefs.next()) { while (useRealisationRefs.next()) {
auto depHash = useRealisationRefs.getStr(0); auto depHash = useRealisationRefs.getStr(0);