hamsterdb Embedded Database
2.1.7
|
#include <hamsterdb.h>
Data Fields | |
ham_u32_t | size |
void * | data |
ham_u32_t | flags |
ham_u32_t | partial_offset |
ham_u32_t | partial_size |
ham_u32_t | _intflags |
ham_u64_t | _rid |
A generic record.
A record represents data items in hamsterdb. Before using a record, it is important to initialize all record fields with zeroes, i.e. with the C library routines memset(3) or bzero(2).
When hamsterdb returns a record structure, the pointer to the record data is provided in data. This pointer is only temporary and will be overwritten by subsequent hamsterdb API calls using the same Transaction (or, if Transactions are disabled, using the same Database). The pointer will also be invalidated after the Transaction is aborted or committed.
To avoid this, the calling application can allocate the data pointer. In this case, you have to set the flag HAM_RECORD_USER_ALLOC. The size parameter will then return the size of the record. It's the responsibility of the caller to make sure that the data parameter is large enough for the record.
The record->data pointer is not threadsafe. For threadsafe access it is recommended to use HAM_RECORD_USER_ALLOC or have each thread manage its own Transaction.
Definition at line 177 of file hamsterdb.h.
ham_u32_t ham_record_t::_intflags |
For internal use
Definition at line 194 of file hamsterdb.h.
ham_u64_t ham_record_t::_rid |
For internal use
Definition at line 197 of file hamsterdb.h.
void* ham_record_t::data |
Pointer to the record data
Definition at line 182 of file hamsterdb.h.
Referenced by hamsterdb::record::get_data(), main(), hamsterdb::record::record(), and hamsterdb::record::set_data().
ham_u32_t ham_record_t::flags |
The record flags; see HAM_RECORD_USER_ALLOC
Definition at line 185 of file hamsterdb.h.
Referenced by hamsterdb::record::get_flags(), hamsterdb::record::record(), and hamsterdb::record::set_flags().
ham_u32_t ham_record_t::partial_offset |
Offset for partial reading/writing; see HAM_PARTIAL
Definition at line 188 of file hamsterdb.h.
ham_u32_t ham_record_t::partial_size |
Size for partial reading/writing; see HAM_PARTIAL
Definition at line 191 of file hamsterdb.h.
ham_u32_t ham_record_t::size |
The size of the record data, in bytes
Definition at line 179 of file hamsterdb.h.
Referenced by hamsterdb::record::get_size(), main(), hamsterdb::record::record(), and hamsterdb::record::set_size().