forked from lix-project/lix
Reformat the sql statements
This commit is contained in:
parent
8d09a4f9a0
commit
7c96a76dd7
1 changed files with 17 additions and 11 deletions
|
@ -713,14 +713,18 @@ void LocalStore::registerDrvOutput(const Realisation & info)
|
||||||
settings.requireExperimentalFeature("ca-derivations");
|
settings.requireExperimentalFeature("ca-derivations");
|
||||||
retrySQLite<void>([&]() {
|
retrySQLite<void>([&]() {
|
||||||
auto state(_state.lock());
|
auto state(_state.lock());
|
||||||
state->stmts->RegisterRealisedOutput
|
state->stmts->RegisterRealisedOutput.use()
|
||||||
.use()(info.id.strHash())(info.id.outputName)(printStorePath(
|
(info.id.strHash())
|
||||||
info.outPath))(concatStringsSep(" ", info.signatures))
|
(info.id.outputName)
|
||||||
|
(printStorePath(info.outPath))
|
||||||
|
(concatStringsSep(" ", info.signatures))
|
||||||
.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->AddRealisationReference
|
state->stmts->AddRealisationReference.use()
|
||||||
.use()(myId)(outputId.strHash())(outputId.outputName)
|
(myId)
|
||||||
|
(outputId.strHash())
|
||||||
|
(outputId.outputName)
|
||||||
.exec();
|
.exec();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1721,8 +1725,9 @@ std::optional<const Realisation> LocalStore::queryRealisation(
|
||||||
typedef std::optional<const Realisation> Ret;
|
typedef std::optional<const Realisation> Ret;
|
||||||
return retrySQLite<Ret>([&]() -> Ret {
|
return retrySQLite<Ret>([&]() -> Ret {
|
||||||
auto state(_state.lock());
|
auto state(_state.lock());
|
||||||
auto useQueryRealisedOutput(state->stmts->QueryRealisedOutput.use()(
|
auto useQueryRealisedOutput(state->stmts->QueryRealisedOutput.use()
|
||||||
id.strHash())(id.outputName));
|
(id.strHash())
|
||||||
|
(id.outputName));
|
||||||
if (!useQueryRealisedOutput.next())
|
if (!useQueryRealisedOutput.next())
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
auto realisationDbId = useQueryRealisedOutput.getInt(0);
|
auto realisationDbId = useQueryRealisedOutput.getInt(0);
|
||||||
|
@ -1732,13 +1737,14 @@ std::optional<const Realisation> LocalStore::queryRealisation(
|
||||||
|
|
||||||
std::map<DrvOutput, StorePath> dependentRealisations;
|
std::map<DrvOutput, StorePath> dependentRealisations;
|
||||||
auto useRealisationRefs(
|
auto useRealisationRefs(
|
||||||
state->stmts->QueryRealisationReferences.use()(
|
state->stmts->QueryRealisationReferences.use()
|
||||||
realisationDbId));
|
(realisationDbId));
|
||||||
while (useRealisationRefs.next()) {
|
while (useRealisationRefs.next()) {
|
||||||
auto depHash = useRealisationRefs.getStr(0);
|
auto depHash = useRealisationRefs.getStr(0);
|
||||||
auto depOutputName = useRealisationRefs.getStr(1);
|
auto depOutputName = useRealisationRefs.getStr(1);
|
||||||
auto useQueryRealisedOutput(
|
auto useQueryRealisedOutput(state->stmts->QueryRealisedOutput.use()
|
||||||
state->stmts->QueryRealisedOutput.use()(depHash)(depOutputName));
|
(depHash)
|
||||||
|
(depOutputName));
|
||||||
assert(useQueryRealisedOutput.next());
|
assert(useQueryRealisedOutput.next());
|
||||||
auto outputPath = parseStorePath(useQueryRealisedOutput.getStr(1));
|
auto outputPath = parseStorePath(useQueryRealisedOutput.getStr(1));
|
||||||
auto depId = DrvOutput { Hash::parseAnyPrefixed(depHash), depOutputName };
|
auto depId = DrvOutput { Hash::parseAnyPrefixed(depHash), depOutputName };
|
||||||
|
|
Loading…
Reference in a new issue