MCPcopy Create free account
hub / github.com/IppClub/Dora-SSR / bindValues

Function bindValues

Source/Basic/Database.cpp:195–209  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

193}
194
195static void bindValues(SQLite::Statement& query, const std::vector<Own<Value>>& args) {
196 int argCount = 0;
197 for (auto& arg : args) {
198 if (auto v = arg->asVal<int64_t>()) {
199 query.bind(++argCount, *v);
200 } else if (auto v = arg->asVal<double>()) {
201 query.bind(++argCount, *v);
202 } else if (auto v = arg->asVal<std::string>()) {
203 query.bind(++argCount, *v);
204 } else if (arg->asVal<bool>() && *arg->asVal<bool>() == false) {
205 query.bind(++argCount);
206 } else
207 throw std::runtime_error("unsupported argument type");
208 }
209}
210
211std::optional<DB::Rows> DB::query(String sql, const std::vector<Own<Value>>& args, bool withColumns) {
212 std::optional<DB::Rows> result;

Callers 3

queryUnsafeMethod · 0.85
insertUnsafeMethod · 0.85
execUnsafeMethod · 0.85

Calls 1

bindMethod · 0.65

Tested by

no test coverage detected