The Import and Export Group contains the APIs for reading and writing records to a file in cdb_dump or db_dump format.
More...
|
int | mdbm_cdbdump_to_file (kvpair kv, FILE *fp) |
| Export API: Use cdb_dump format to write a key/value pair to file opened with fopen. More...
|
|
int | mdbm_cdbdump_trailer_and_close (FILE *fp) |
| Export API: Finalize and close a file written in cdb_dump format and opened with fopen. More...
|
|
int | mdbm_cdbdump_add_record (kvpair kv, uint32_t *datasize, char **bufptr, uint32_t *bufsize, uint32_t buf_offset) |
| Export API: Use cdb_dump format to write a key/value pair to a malloc'd buffer. More...
|
|
int | mdbm_dbdump_to_file (kvpair kv, FILE *fp) |
| Export API: Use db_dump format to write a key/value pair to a file opened with fopen. More...
|
|
int | mdbm_dbdump_trailer_and_close (FILE *fp) |
| Export API: Finalize and close a file written in db_dump format and opened with fopen. More...
|
|
int | mdbm_dbdump_add_record (kvpair kv, uint32_t *datasize, char **bufptr, uint32_t *bufsize, uint32_t buf_offset) |
| Export API: Use db_dump format to write a key/value pair to a malloc'd buffer. More...
|
|
int | mdbm_dbdump_export_header (MDBM *db, FILE *fp) |
| Export API: Write the DBdump header to FILE. More...
|
|
int | mdbm_dbdump_import_header (FILE *fp, int *pgsize, int *pgcount, int *large, uint32_t *lineno) |
| Import API: Read the DBdump header from FILE Function will set, if available at the beginning of the file pointed to by "fp", the following parameter values: More...
|
|
int | mdbm_dbdump_import (MDBM *db, FILE *fp, const char *input_file, int store_flag, uint32_t *lineno) |
| Import API: Read data from FILE into MDBM, using DBdump format. More...
|
|
int | mdbm_cdbdump_import (MDBM *db, FILE *fp, const char *input_file, int store_flag) |
| Import API: Read data from FILE into MDBM, using Cdb format. More...
|
|
The Import and Export Group contains the APIs for reading and writing records to a file in cdb_dump or db_dump format.
Utility functions for converting from MDBM files into a textual representation. These functions generate data in one of 2 formats:
- The "printable" BerkeleyDB db_{dump,load} format
- The cdb_dump format, which is a little more compact because it uses binary representation instead of escaped hex sequences: http://cr.yp.to/cdb/cdbmake.html
int mdbm_cdbdump_to_file |
( |
kvpair |
kv, |
|
|
FILE * |
fp |
|
) |
| |
Export API: Use cdb_dump format to write a key/value pair to file opened with fopen.
- Parameters
-
[in] | kv | Key+Value pair |
[in,out] | fp | FILE pointer (return value of fopen) |
- Returns
- Dump kvpair to file status
- Return values
-
-1 | Error, and errno is set |
0 | Success |
int mdbm_cdbdump_trailer_and_close |
( |
FILE * |
fp | ) |
|
Export API: Finalize and close a file written in cdb_dump format and opened with fopen.
Adds newline character as the file "trailer" and closes the file.
- Parameters
-
[in,out] | fp | FILE pointer (return value of fopen) |
- Returns
- Dump trailer to file status
- Return values
-
-1 | Error, and errno is set |
0 | Success |
int mdbm_cdbdump_add_record |
( |
kvpair |
kv, |
|
|
uint32_t * |
datasize, |
|
|
char ** |
bufptr, |
|
|
uint32_t * |
bufsize, |
|
|
uint32_t |
buf_offset |
|
) |
| |
Export API: Use cdb_dump format to write a key/value pair to a malloc'd buffer.
- Parameters
-
[in] | kv | Key+Value pair |
[in,out] | datasize | Size of cdb_dump data to be added added to bufptr |
[in,out] | bufptr | malloc'd buffer. bufptr may be realloc'd if datasize is greater than bufsize |
[in] | bufsize | Size of malloc'd buffer |
[in] | buf_offset | Offset in bufptr to start writing data |
- Returns
- Add record status
- Return values
-
-1 | Error, and errno is set |
0 | Success |
int mdbm_dbdump_to_file |
( |
kvpair |
kv, |
|
|
FILE * |
fp |
|
) |
| |
Export API: Use db_dump format to write a key/value pair to a file opened with fopen.
- Parameters
-
[in] | kv | Key+Value pair |
[in,out] | fp | FILE pointer (return value of fopen) |
- Returns
- Dump to file status
- Return values
-
-1 | Error, and errno is set |
0 | Success |
int mdbm_dbdump_trailer_and_close |
( |
FILE * |
fp | ) |
|
Export API: Finalize and close a file written in db_dump format and opened with fopen.
No trailer written: just closes the file (using fclose).
- Parameters
-
[in,out] | fp | FILE pointer (return value of fopen) |
- Returns
- Dump trailer status
- Return values
-
-1 | Error, and errno is set |
0 | Success |
int mdbm_dbdump_add_record |
( |
kvpair |
kv, |
|
|
uint32_t * |
datasize, |
|
|
char ** |
bufptr, |
|
|
uint32_t * |
bufsize, |
|
|
uint32_t |
buf_offset |
|
) |
| |
Export API: Use db_dump format to write a key/value pair to a malloc'd buffer.
mdbm_dbdump_add_record may realloc bufptr.
- Parameters
-
[in] | kv | Key+Value pair |
[in,out] | datasize | Size of db_dump data to be added added to bufptr |
[in,out] | bufptr | malloc'd buffer. bufptr may be realloc'd if datasize is greater than bufsize |
[in] | bufsize | Size of malloc'd buffer |
[in] | buf_offset | Offset in bufptr to start writing data |
- Returns
- Dump add record status
- Return values
-
-1 | Error, and errno is set |
0 | Success |
int mdbm_dbdump_export_header |
( |
MDBM * |
db, |
|
|
FILE * |
fp |
|
) |
| |
Export API: Write the DBdump header to FILE.
- Parameters
-
[in,out] | db | handle of MDBM whose data is being exported |
[in] | fp | file handle/pointer to read from |
int mdbm_dbdump_import_header |
( |
FILE * |
fp, |
|
|
int * |
pgsize, |
|
|
int * |
pgcount, |
|
|
int * |
large, |
|
|
uint32_t * |
lineno |
|
) |
| |
Import API: Read the DBdump header from FILE Function will set, if available at the beginning of the file pointed to by "fp", the following parameter values:
- Parameters
-
[in] | fp | file handle/pointer to read from |
[out] | pgsize | page-size read from "fp" |
[out] | pgcount | page-count read from "fp" |
[out] | large | large-object-support |
[out] | lineno | The line number following the header (for tracking progress) |
int mdbm_dbdump_import |
( |
MDBM * |
db, |
|
|
FILE * |
fp, |
|
|
const char * |
input_file, |
|
|
int |
store_flag, |
|
|
uint32_t * |
lineno |
|
) |
| |
Import API: Read data from FILE into MDBM, using DBdump format.
MDBM locking and unlocking is done one record at a time based on locking set up when the MDBM was opened.
- Parameters
-
[in,out] | db | handle of MDBM into which data is being imported |
[in] | fp | file handle/pointer to read from |
[in] | input_file | name of the file pointed to by "fp". |
[in] | store_flag | MDBM_INSERT | MDBM_REPLACE | MDBM_INSERT_DUP | MDBM_MODIFY |
[in,out] | lineno | current line number, keep track of the current line number to generate meaningful error messages. Precondition: set to 1 or pass line number previously set by mdbm_dbdump_import_header. Postcondition: lineno will hold the last line number read successfully. |
int mdbm_cdbdump_import |
( |
MDBM * |
db, |
|
|
FILE * |
fp, |
|
|
const char * |
input_file, |
|
|
int |
store_flag |
|
) |
| |
Import API: Read data from FILE into MDBM, using Cdb format.
MDBM locking and unlocking is done one record at a time based on locking set up when the MDBM was opened.
- Parameters
-
[in,out] | db | handle of MDBM into which data is being imported |
[in] | fp | file handle/pointer to read from |
[in] | input_file | name of the file pointed to by "fp". |
[in] | store_flag | MDBM_INSERT | MDBM_REPLACE | MDBM_INSERT_DUP | MDBM_MODIFY |