|
|
| db_len_t db::CursorRowAccessor::write_blob |
( |
int |
field, |
|
|
db_len_t |
offset, |
|
|
const void * |
data, |
|
|
db_len_t |
len | |
|
) |
| | [virtual, inherited] |
Write an array of bytes to any position in a BLOB (Binary Large OBject) field.
Because BLOBs can be arbitrarily large they must be written to in discrete sections. The byte array given by data will be stored at the offset position within the BLOB field.
write_blob should be used when inserting a new BLOB or when updating any chunk of an existing BLOB without reducing that BLOB's size. write_blob will automatically increase the size of an existing BLOB if given the end of the blob as its offset
- Parameters:
-
| field | The index of the field that should be written to. Use find_field to obtain this index. (>=0, <# of fields) (required) |
| offset | The offset into the BLOB where data will be written. (>=0) |
| data | The byte array which will be written to the BLOB. |
| len | The length of data in bytes. (>=0) |
- Returns:
- Amount of data written to BLOB in bytes when successful, otherwise:
- DB_EFIELD If field is not within required range, or if field is not of type FIELD_TYPE_BLOB
- DB_EINVAL If data is NULL but len is positive, or offset < 0, or len < 0.
- DB_ESTATE If table not opened, or table not in DB_TABLE_BROWSING mode.
- Precondition:
- The table must be in DB_TABLE_BROWSING mode.
The row must already be inserted before calling write_blob.
- See also:
- write_blob_final, read_blob, get_blob_size, truncate_blob
Implements db::RowAccessor.
|