22struct StatementHandle;
31class SQLITE_HELPERS_API
Row final
39 bool Get(
int columnIndex,
bool& value)
const;
40 bool Get(
int columnIndex,
int& value)
const;
41 bool Get(
int columnIndex,
long& value)
const;
42 bool Get(
int columnIndex,
long long& value)
const;
43 bool Get(
int columnIndex,
float& value)
const;
44 bool Get(
int columnIndex,
double& value)
const;
45 bool Get(
int columnIndex, std::string& value)
const;
47 template <
typename T> T
GetOr(
int columnIndex, T defaultValue = T())
const
50 return Get(columnIndex, value) ? value : defaultValue;
53 int GetColumnCount()
const;
55 int64_t GetColumnBytes(
int columnIndex)
const;
56 int64_t ReadData(
int columnIndex,
void* buffer, int64_t maxSize)
const;
59 template <
typename Reader>
60 bool DoGet(Reader reader,
int columnIndex)
const;
63 std::vector<Error>* mErrors {};
64 int mColumnsCount { 0 };
84 bool operator==(const
RowIterator& other) const noexcept;
85 bool operator!=(const
RowIterator& other) const noexcept;
87 Row operator*() const noexcept;
91 std::vector<Error>* mErrors {};
111 bool IsOk() const noexcept;
112 bool HasRows() const noexcept;
114 int GetModifiedRowsCount() const noexcept;
116 const
std::vector<
Error>& GetErrors() const noexcept;
124 int mModifiedRowsCount { 0 };
125 bool mHasRows {
false };
144 Bind(
int index, const
void* data, int64_t
size,
bool makeCopy = true);
146 RunContext& Bind(
int index, const
std::
string& value,
bool makeCopy = true);
147 RunContext& Bind(
int index,
std::string_view value,
bool makeCopy = true);
148 RunContext& Bind(
int index, const
char* value,
bool makeCopy = true);
164 return Bind(GetParameterIndex(
name), value);
167 template <
typename T>
170 return Bind(GetParameterIndex(
name), value, make_copy);
176 (Bind(++index, std::forward<Args>(args)), ...);
180 int GetParameterIndex(
const std::string&
name)
const noexcept;
185 template <
typename Binder>
RunContext& DoBind(Binder binder);
188 std::vector<Error> mErrors {};
189 bool mNeedsReset {
false };
215 template<typename... Args>
218 return Prepare().
BindAll(std::forward<Args>(args)...);
223 std::optional<RunContext> mRunContext {};
A class representing a connection to a SQLite database.
A class representing an error in SQLite.
A class representing a row in a result set.
T GetOr(int columnIndex, T defaultValue=T()) const
A class representing an iterator over a result set.
A class representing a context of a run operation.
RunContext & BindAll(Args &&... args)
RunContext & Bind(const std::string &name, const T &value, bool make_copy)
RunContext(const RunContext &)=delete
A class representing a result of a run operation.
RunResult(const RunResult &)=delete
A class representing a compiled statement.
Statement(const Statement &)=delete
Services * Get()
Fetch the global instance, or nullptr if none is yet installed.
std::shared_ptr< StatementHandle > StatementHandlePtr
const char * end(const char *str) noexcept
const char * begin(const char *str) noexcept