Skip to content

Commit

Permalink
API: Added C4Query::parameterNames()
Browse files Browse the repository at this point in the history
  • Loading branch information
snej committed Aug 29, 2024
1 parent 2d93e82 commit 1585ab9
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions C/Cpp_include/c4Query.hh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <memory>
#include <mutex>
#include <set>
#include <string>
#include <utility>

C4_ASSUME_NONNULL_BEGIN
Expand Down Expand Up @@ -48,6 +49,7 @@ struct C4Query final
slice columnTitle(unsigned col) const;
alloc_slice explain() const;

const std::set<std::string>& parameterNames() const noexcept;
alloc_slice parameters() const noexcept;
void setParameters(slice parameters);

Expand Down
4 changes: 4 additions & 0 deletions C/c4Query.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ alloc_slice C4Query::fullTextMatched(const C4FullTextMatch& term) {
return _query->getMatchedText((Query::FullTextTerm&)term);
}

const set<string>& C4Query::parameterNames() const noexcept {
return _query->parameterNames();
}

alloc_slice C4Query::parameters() const noexcept {
LOCK(_mutex);
return _parameters;
Expand Down
3 changes: 3 additions & 0 deletions LiteCore/Query/Query.hh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "Error.hh"
#include "Logging.hh"
#include <atomic>
#include <set>
#include <utility>
#include <vector>

Expand Down Expand Up @@ -56,6 +57,8 @@ namespace litecore {

virtual const std::vector<std::string>& columnTitles() const noexcept = 0;

virtual const std::set<std::string>& parameterNames() const noexcept = 0;

virtual alloc_slice getMatchedText(const FullTextTerm&) = 0;

virtual std::string explain() = 0;
Expand Down
2 changes: 2 additions & 0 deletions LiteCore/Query/SQLiteQuery.cc
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@ namespace litecore {

const vector<string>& columnTitles() const noexcept override { return _columnTitles; }

const set<string>& parameterNames() const noexcept override {return _parameters;}

string explain() override {
stringstream result;
// https://www.sqlite.org/eqp.html
Expand Down

0 comments on commit 1585ab9

Please sign in to comment.