| 193 | } |
| 194 | |
| 195 | static 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 | |
| 211 | std::optional<DB::Rows> DB::query(String sql, const std::vector<Own<Value>>& args, bool withColumns) { |
| 212 | std::optional<DB::Rows> result; |
no test coverage detected