Remove added strictness to allow multiple query returns.

This commit is contained in:
Kevin Quick 2020-01-12 10:18:52 -08:00
parent 7bb6b5e206
commit ec8b2970e0
No known key found for this signature in database
GPG key ID: E6D7733599CC0A21

View file

@ -606,21 +606,21 @@ BuildOutput State::getBuildOutputCached(Connection & conn, nix::ref<nix::Store>
pqxx::work txn(conn); pqxx::work txn(conn);
for (auto & output : drv.outputs) { for (auto & output : drv.outputs) {
auto r = txn.exec_params1 auto r = txn.exec_params
("select id, buildStatus, releaseName, closureSize, size from Builds b " ("select id, buildStatus, releaseName, closureSize, size from Builds b "
"join BuildOutputs o on b.id = o.build " "join BuildOutputs o on b.id = o.build "
"where finished = 1 and (buildStatus = 0 or buildStatus = 6) and path = $1", "where finished = 1 and (buildStatus = 0 or buildStatus = 6) and path = $1",
output.second.path); output.second.path);
if (r.empty()) continue; if (r.empty()) continue;
BuildID id = r[0].as<BuildID>(); BuildID id = r[0][0].as<BuildID>();
printMsg(lvlInfo, format("reusing build %d") % id); printMsg(lvlInfo, format("reusing build %d") % id);
BuildOutput res; BuildOutput res;
res.failed = r[1].as<int>() == bsFailedWithOutput; res.failed = r[0][1].as<int>() == bsFailedWithOutput;
res.releaseName = r[2].is_null() ? "" : r[2].as<std::string>(); res.releaseName = r[0][2].is_null() ? "" : r[0][2].as<std::string>();
res.closureSize = r[3].is_null() ? 0 : r[3].as<unsigned long long>(); res.closureSize = r[0][3].is_null() ? 0 : r[0][3].as<unsigned long long>();
res.size = r[4].is_null() ? 0 : r[4].as<unsigned long long>(); res.size = r[0][4].is_null() ? 0 : r[0][4].as<unsigned long long>();
auto products = txn.exec_params auto products = txn.exec_params
("select type, subtype, fileSize, sha1hash, sha256hash, path, name, defaultPath from BuildProducts where build = $1 order by productnr", ("select type, subtype, fileSize, sha1hash, sha256hash, path, name, defaultPath from BuildProducts where build = $1 order by productnr",