partial bitcoin#27790: Add PrefixCursor

includes:
- 84b2f353 (excludes `src/wallet/test/util.cpp`)
This commit is contained in:
Kittywhiskers Van Gogh 2023-05-15 15:50:35 -04:00
parent d85003a7af
commit 67b0621edf
No known key found for this signature in database
GPG Key ID: 30CD0C065E5C4AAD
2 changed files with 5 additions and 0 deletions

View File

@ -756,6 +756,7 @@ bool BerkeleyBatch::ReadKey(CDataStream&& key, CDataStream& value)
SafeDbt datValue;
int ret = pdb->get(activeTxn, datKey, datValue, 0);
if (ret == 0 && datValue.get_data() != nullptr) {
value.clear();
value.write({AsBytePtr(datValue.get_data()), datValue.get_size()});
return true;
}

View File

@ -406,6 +406,7 @@ bool SQLiteBatch::ReadKey(CDataStream&& key, CDataStream& value)
// Leftmost column in result is index 0
const std::byte* data{AsBytePtr(sqlite3_column_blob(m_read_stmt, 0))};
size_t data_size(sqlite3_column_bytes(m_read_stmt, 0));
value.clear();
value.write({data, data_size});
sqlite3_clear_bindings(m_read_stmt);
@ -495,6 +496,9 @@ bool SQLiteBatch::ReadAtCursor(CDataStream& key, CDataStream& value, bool& compl
return false;
}
key.clear();
value.clear();
// Leftmost column in result is index 0
const std::byte* key_data{AsBytePtr(sqlite3_column_blob(m_cursor_stmt, 0))};
size_t key_data_size(sqlite3_column_bytes(m_cursor_stmt, 0));