Skip to content

Commit

Permalink
Allow to specify union separator
Browse files Browse the repository at this point in the history
  • Loading branch information
lostystyg committed Aug 20, 2022
1 parent fcf526c commit 1d371a0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/pocketdb/repositories/web/WebRpcRepository.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4736,7 +4736,7 @@ namespace PocketDb
static inline auto _constructSelectsBasedOnFilters(
const std::set<ShortTxType>& filters,
const std::map<ShortTxType, ShortFormSqlEntry<std::shared_ptr<sqlite3_stmt*>&, QueryParams>>& selects,
const std::string& footer)
const std::string& footer, const std::string& separator = "union")
{
// Choosing predicate for function above based on filters.
const static auto choosePredicate = [](const std::set<ShortTxType>& filters) -> std::function<bool(const ShortTxType&)> {
Expand All @@ -4758,7 +4758,7 @@ namespace PocketDb
for (const auto& select: selects) {
if (predicate(select.first)) {
queryElems.emplace_back(select.second.query);
queryElems.emplace_back("union");
queryElems.emplace_back(separator);
binds.emplace_back(select.second.binding);
}
}
Expand Down Expand Up @@ -7038,7 +7038,7 @@ namespace PocketDb
}}
};

auto [elem1, elem2] = _constructSelectsBasedOnFilters(filters, selects, "");
auto [elem1, elem2] = _constructSelectsBasedOnFilters(filters, selects, "", "union all");
auto& sql = elem1;
auto& binds = elem2;

Expand Down

0 comments on commit 1d371a0

Please sign in to comment.