MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / ExecStatement

Method ExecStatement

src/wallet/sqlite.cpp:523–545  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

521}
522
523bool SQLiteBatch::ExecStatement(sqlite3_stmt* stmt, std::span<const std::byte> blob)
524{
525 if (!m_database.m_db) return false;
526 assert(stmt);
527
528 // Bind: leftmost parameter in statement is index 1
529 if (!BindBlobToStatement(stmt, 1, blob, "key")) return false;
530
531 // Acquire semaphore if not previously acquired when creating a transaction.
532 if (!m_txn) m_database.m_write_semaphore.acquire();
533
534 // Execute
535 int res = sqlite3_step(stmt);
536 sqlite3_clear_bindings(stmt);
537 sqlite3_reset(stmt);
538 if (res != SQLITE_DONE) {
539 LogWarning("Unable to execute exec statement: %s", sqlite3_errstr(res));
540 }
541
542 if (!m_txn) m_database.m_write_semaphore.release();
543
544 return res == SQLITE_DONE;
545}
546
547bool SQLiteBatch::EraseKey(DataStream&& key)
548{

Callers

nothing calls this directly

Calls 2

BindBlobToStatementFunction · 0.85
releaseMethod · 0.80

Tested by

no test coverage detected