mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 12:32:48 +01:00
partial bitcoin#27790: Add PrefixCursor
includes: - 84b2f353 (excludes `src/wallet/test/util.cpp`)
This commit is contained in:
parent
d85003a7af
commit
67b0621edf
@ -756,6 +756,7 @@ bool BerkeleyBatch::ReadKey(CDataStream&& key, CDataStream& value)
|
|||||||
SafeDbt datValue;
|
SafeDbt datValue;
|
||||||
int ret = pdb->get(activeTxn, datKey, datValue, 0);
|
int ret = pdb->get(activeTxn, datKey, datValue, 0);
|
||||||
if (ret == 0 && datValue.get_data() != nullptr) {
|
if (ret == 0 && datValue.get_data() != nullptr) {
|
||||||
|
value.clear();
|
||||||
value.write({AsBytePtr(datValue.get_data()), datValue.get_size()});
|
value.write({AsBytePtr(datValue.get_data()), datValue.get_size()});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -406,6 +406,7 @@ bool SQLiteBatch::ReadKey(CDataStream&& key, CDataStream& value)
|
|||||||
// Leftmost column in result is index 0
|
// Leftmost column in result is index 0
|
||||||
const std::byte* data{AsBytePtr(sqlite3_column_blob(m_read_stmt, 0))};
|
const std::byte* data{AsBytePtr(sqlite3_column_blob(m_read_stmt, 0))};
|
||||||
size_t data_size(sqlite3_column_bytes(m_read_stmt, 0));
|
size_t data_size(sqlite3_column_bytes(m_read_stmt, 0));
|
||||||
|
value.clear();
|
||||||
value.write({data, data_size});
|
value.write({data, data_size});
|
||||||
|
|
||||||
sqlite3_clear_bindings(m_read_stmt);
|
sqlite3_clear_bindings(m_read_stmt);
|
||||||
@ -495,6 +496,9 @@ bool SQLiteBatch::ReadAtCursor(CDataStream& key, CDataStream& value, bool& compl
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
key.clear();
|
||||||
|
value.clear();
|
||||||
|
|
||||||
// Leftmost column in result is index 0
|
// Leftmost column in result is index 0
|
||||||
const std::byte* key_data{AsBytePtr(sqlite3_column_blob(m_cursor_stmt, 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));
|
size_t key_data_size(sqlite3_column_bytes(m_cursor_stmt, 0));
|
||||||
|
Loading…
Reference in New Issue
Block a user