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

Method insertUnsafe

Source/Basic/Database.cpp:254–268  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

252}
253
254void DB::insertUnsafe(SQLite::Database* db, String tableName, const std::deque<std::vector<Own<Value>>>& rows) {
255 if (rows.empty() || rows.front().empty()) return;
256 std::string valueHolder;
257 for (size_t i = 0; i < rows.front().size(); i++) {
258 valueHolder += '?';
259 if (i != rows.front().size() - 1) valueHolder += ',';
260 }
261 SQLite::Statement statement(*db, fmt::format("INSERT INTO {} VALUES ({})", tableName.toString(), valueHolder));
262 for (const auto& row : rows) {
263 statement.clearBindings();
264 bindValues(statement, row);
265 statement.exec();
266 statement.reset();
267 }
268}
269
270int DB::execUnsafe(SQLite::Database* db, String sql) {
271 SQLite::Statement statement(*db, sql.toString());

Callers

nothing calls this directly

Calls 9

bindValuesFunction · 0.85
clearBindingsMethod · 0.80
toStringMethod · 0.65
execMethod · 0.65
formatFunction · 0.50
emptyMethod · 0.45
frontMethod · 0.45
sizeMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected