MCPcopy Create free account
hub / github.com/LUX-Core/lux / ReadAtCursor

Method ReadAtCursor

src/db.h:234–269  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

232 }
233
234 int ReadAtCursor(Dbc* pcursor, CDataStream& ssKey, CDataStream& ssValue, unsigned int fFlags = DB_NEXT)
235 {
236 // Read at cursor
237 Dbt datKey;
238 if (fFlags == DB_SET || fFlags == DB_SET_RANGE || fFlags == DB_GET_BOTH || fFlags == DB_GET_BOTH_RANGE) {
239 datKey.set_data(ssKey.data());
240 datKey.set_size(ssKey.size());
241 }
242 Dbt datValue;
243 if (fFlags == DB_GET_BOTH || fFlags == DB_GET_BOTH_RANGE) {
244 datValue.set_data(&ssValue[0]);
245 datValue.set_size(ssValue.size());
246 }
247 datKey.set_flags(DB_DBT_MALLOC);
248 datValue.set_flags(DB_DBT_MALLOC);
249 int ret = pcursor->get(&datKey, &datValue, fFlags);
250 if (ret != 0)
251 return ret;
252 else if (datKey.get_data() == NULL || datValue.get_data() == NULL)
253 return 99999;
254
255 // Convert to streams
256 ssKey.SetType(SER_DISK);
257 ssKey.clear();
258 ssKey.write((char*)datKey.get_data(), datKey.get_size());
259 ssValue.SetType(SER_DISK);
260 ssValue.clear();
261 ssValue.write((char*)datValue.get_data(), datValue.get_size());
262
263 // Clear and free memory
264 memory_cleanse(datKey.get_data(), datKey.get_size());
265 memory_cleanse(datValue.get_data(), datValue.get_size());
266 free(datKey.get_data());
267 free(datValue.get_data());
268 return 0;
269 }
270
271public:
272 bool TxnBegin()

Callers 1

RewriteMethod · 0.80

Calls 8

memory_cleanseFunction · 0.85
set_sizeMethod · 0.80
dataMethod · 0.45
sizeMethod · 0.45
getMethod · 0.45
SetTypeMethod · 0.45
clearMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected