src/DistroqueryAPI: getProvidersForRequirementFromDb: fix for requirements not found if of arch 'noarch'
This commit is contained in:
parent
a89f9552ec
commit
fd5a9768da
@ -259,7 +259,7 @@ json DistroqueryAPI::getProvidersForRequirementFromDb(sqlite3 *db , configTag* c
|
|||||||
while (ct->repository[i]) {
|
while (ct->repository[i]) {
|
||||||
if (a + i > 0) sql += " UNION ";
|
if (a + i > 0) sql += " UNION ";
|
||||||
sql += "SELECT *,'" + string(ct->repository[i]->tag) + "' AS repository,'" +
|
sql += "SELECT *,'" + string(ct->repository[i]->tag) + "' AS repository,'" +
|
||||||
arch + "' AS arch "
|
arch + "' AS qarch "
|
||||||
"FROM '" + string(ct->repository[i]->tag) + "_" + arch + "'.provides,'" +
|
"FROM '" + string(ct->repository[i]->tag) + "_" + arch + "'.provides,'" +
|
||||||
string(ct->repository[i]->tag) + "_" + arch + "'.packages "
|
string(ct->repository[i]->tag) + "_" + arch + "'.packages "
|
||||||
"WHERE providename='" + requirement + "' AND packages.id=provides.id_package";
|
"WHERE providename='" + requirement + "' AND packages.id=provides.id_package";
|
||||||
@ -275,9 +275,10 @@ json DistroqueryAPI::getProvidersForRequirementFromDb(sqlite3 *db , configTag* c
|
|||||||
if (sqlite3_prepare_v2(db, sql.c_str(), sql.length(), &stmt, NULL) == SQLITE_OK) {
|
if (sqlite3_prepare_v2(db, sql.c_str(), sql.length(), &stmt, NULL) == SQLITE_OK) {
|
||||||
json providers = json::array();
|
json providers = json::array();
|
||||||
while (sqlite3_step(stmt) == SQLITE_ROW) {
|
while (sqlite3_step(stmt) == SQLITE_ROW) {
|
||||||
string arch = reinterpret_cast<const char*>(sqlite3_column_text(stmt,sqlite3_find_column_id(stmt, NULL, "arch")));
|
// Differentiate queried arch from package arch which might also be 'noarch'
|
||||||
if (!archs.contains(arch)) {
|
string qarch = reinterpret_cast<const char*>(sqlite3_column_text(stmt,sqlite3_find_column_id(stmt, NULL, "qarch")));
|
||||||
archs[arch] = json::array();
|
if (!archs.contains(qarch)) {
|
||||||
|
archs[qarch] = json::array();
|
||||||
}
|
}
|
||||||
json provider = {};
|
json provider = {};
|
||||||
provider["repository"] = reinterpret_cast<const char*>(sqlite3_column_text(stmt,sqlite3_find_column_id(stmt, NULL, "repository")));
|
provider["repository"] = reinterpret_cast<const char*>(sqlite3_column_text(stmt,sqlite3_find_column_id(stmt, NULL, "repository")));
|
||||||
@ -292,7 +293,7 @@ json DistroqueryAPI::getProvidersForRequirementFromDb(sqlite3 *db , configTag* c
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
archs[arch].push_back(provider);
|
archs[qarch].push_back(provider);
|
||||||
}
|
}
|
||||||
//j["providers"] = providers;
|
//j["providers"] = providers;
|
||||||
sqlite3_finalize(stmt);
|
sqlite3_finalize(stmt);
|
||||||
|
Loading…
Reference in New Issue
Block a user