| 462 | } |
| 463 | |
| 464 | bool SQLiteBatch::ReadKey(DataStream&& key, DataStream& value) |
| 465 | { |
| 466 | if (!m_database.m_db) return false; |
| 467 | assert(m_read_stmt); |
| 468 | |
| 469 | // Bind: leftmost parameter in statement is index 1 |
| 470 | if (!BindBlobToStatement(m_read_stmt, 1, key, "key")) return false; |
| 471 | int res = sqlite3_step(m_read_stmt); |
| 472 | if (res != SQLITE_ROW) { |
| 473 | if (res != SQLITE_DONE) { |
| 474 | // SQLITE_DONE means "not found", don't log an error in that case. |
| 475 | LogWarning("Unable to execute read statement: %s", sqlite3_errstr(res)); |
| 476 | } |
| 477 | sqlite3_clear_bindings(m_read_stmt); |
| 478 | sqlite3_reset(m_read_stmt); |
| 479 | return false; |
| 480 | } |
| 481 | // Leftmost column in result is index 0 |
| 482 | value.clear(); |
| 483 | value.write(SpanFromBlob(m_read_stmt, 0)); |
| 484 | |
| 485 | sqlite3_clear_bindings(m_read_stmt); |
| 486 | sqlite3_reset(m_read_stmt); |
| 487 | return true; |
| 488 | } |
| 489 | |
| 490 | bool SQLiteBatch::WriteKey(DataStream&& key, DataStream&& value, bool overwrite) |
| 491 | { |
nothing calls this directly
no test coverage detected