Collaboration diagram for Utility functions:

Functions

RDM_RETCODE rdm_dbExport (RDM_DB db, const char *optString)
Database Export API. More...
RDM_RETCODE rdm_dbVacuum (RDM_DB db, const char *optString)
Database vacuum API. More...
RDM_RETCODE rdm_dbCreateNewPackFile (RDM_DB db)
Create a new pack file. More...
RDM_RETCODE rdm_dbImport (RDM_DB db, const char *optString)
Database Import API. More...
RDM_RETCODE rdm_dbRebuildKey (RDM_DB db, RDM_KEY_ID keyId, uint32_t reportFrequency, RDM_REBUILD_INDEX_REPORT_FCN *fcn)
Rebuild keys for an index. More...
RDM_RETCODE rdm_dbRebuildKeys (RDM_DB db, uint32_t numKeys, const RDM_KEY_ID *keyId, uint32_t reportFrequency, RDM_REBUILD_INDEX_REPORT_FCN *fcn)
Rebuild keys for one or more indexes. More...

Detailed Description

Utility API for a database. Unless otherwise stated functions here are located in RaimaDB DB Engine Library. Linker option:

    -lrdmrdm

Function Documentation

rdm_dbCreateNewPackFile()

RDM_RETCODE rdm_dbCreateNewPackFile ( RDM_DB db )

#include <rdmdbapi.h>

Create a new pack file.

This API forces the database to create a new pack file. All changes will now be written to the new pack. A new pack is typically created when the current pack reaches the max-pack-file-size threshold. This function forces a new pack independent of the size of the current pack.

This function is located in RaimaDB DB Engine Library. Linker option:

    -lrdmrdm
Locking Requirements
None
Return values
sOKAY Normal, successful return.
eDBNOTOPEN Database not open.
See also
rdm_dbSetOptions
rdm_dbVacuum
rdm-vacuum
Parameters
[in] db A valid RaimaDB database handle

rdm_dbExport()

RDM_RETCODE rdm_dbExport ( RDM_DB db,
const char * optString
)

#include <rdmdbapi.h>

Database Export API.

This API exports data from the database to text files or XML files that can then be moved to another computer or used as input into other tools that read the formatted files (for example: rdm_dbImport()).

The optString argument is a semicolon delimited string of options for the rdm_dbExport() processing. The available options are key/value pairs to set the export processing options (e.g.type=xml).

Options are defined using keys or properties. Every key has a name and a value, delimited by an equals sign (=). The key name appears to the left of the equals sign. Key names are not case-sensitive. Unless otherwise noted, values are not case-sensitive.For example, the option string can be defined as: "force=On;type=XML".

Key Value Description
force Overwrite an existing export output file.
nocolumnlist Do not include the list of columns in the generated SQL INSERT statement (SQL export only).
noschema Do not export the schema definition (SQL export only).
notriggers Do not export the triggers (SQL export only).
output Name of the export output file.
schemaonly Export only the schema definition (SQL export only).
table Names of the specific tables for which to export data.
triggersonly Export only the triggers (SQL export only).
type Export file type (XML, CSV, SQL, or RAW).
usesnapshot Start a snapshot to read the content of the database.

This function is located in RaimaDB Export Library. Linker option:

    -lrdmexport
Return values
sOKAY Normal, successful return.
eDBNOTOPEN Database not open.
eFILEEXIST Unable to create file due to an already existing file.
eFILEIO File I/O error.
eFILEOPEN Unable to open file.
eNOMEMORY Out of memory.
eTRACTIVE Transaction is active.
See also
rdm_dbImport
rdm_dbPersistInMemory
rdm-export
Parameters
[in] db A valid RaimaDB database handle
[in] optString A semicolon delimited string that contains the utility options

rdm_dbImport()

RDM_RETCODE rdm_dbImport ( RDM_DB db,
const char * optString
)

#include <rdmdbapi.h>

Database Import API.

This API imports data into an existing database from text files using the following format: comma-separated (CSV), XML, SQL or "raw" (JSON)

The optString argument is a semicolon delimited string of options for the rdm_dbImport() processing. The available options are key/value pairs to set the import processing options (e.g. filename=importdata.sql).

Note
The filename option is the only required option for the optString argument.

Options are defined using keys or properties. Every key has a name and a value, delimited by an equals sign (=). The key name appears to the left of the equals sign. Key names are not case-sensitive. Unless otherwise noted, values are not case-sensitive.For example, the option string can be defined as: "force=On;commit=1000".

Key Value Description
commit Commit per this number of rows.
dateformat Specify default display format for date.
timeformat Specify default display format for time.
force Overwrite an existing database.
table Specify target table for import.
append Append to an existing database.
filename Name of the text file containing import data.

This function is located in RaimaDB Import Library. Linker option:

    -lrdmimport
Return values
sOKAY Normal, successful return.
eDBEXISTS Database already exists.
eDBNOTOPEN Database not open.
eFILEIO File I/O error.
eFILEOPEN Unable to open file.
eNOMEMORY Out of memory.
eTRACTIVE Transaction is active.
See also
rdm_dbExport
rdm-import
Parameters
[in] db A valid RaimaDB database handle
[in] optString A semicolon delimited string that contains the utility options

rdm_dbRebuildKey()

RDM_RETCODE rdm_dbRebuildKey ( RDM_DB db,
RDM_KEY_ID keyId,
uint32_t reportFrequency,
RDM_REBUILD_INDEX_REPORT_FCN * fcn
)

#include <rdmdbapi.h>

Rebuild keys for an index.

This function allows an application to rebuild keys for the index specified by keyId.

If reportFrequency is non-zero and fcn is not NULL, rdm_dbRebuildKey() calls the report function pointed to by fcn every reportFrequency rows it has successfully processed.

Locking Requirements
The table the key is on must be write locked.
Return values
sOKAY Normal, successful return.
eDBNOTOPEN Database not open.
eREADONLY Database is read-only and cannot be updated.
eNOSTARTUPDATE An update operation was attempted when no rdm_dbStartUpdate() is active.
eNOTLOCKED Attempt to access a table for reading or update without proper locks.
ePRECOMMITTED A precommitted transaction must be committed or rolled back before further operations on this database are allowed.
See also
rdm_dbStartUpdate
rdm_dbImport
rdm_dbEnd
rdm_dbRebuildKeys
Parameters
[in] db A valid RaimaDB database handle
[in] keyId The RaimaDB key identifier
[in] reportFrequency how often to report status on the rebuild
[in] fcn A function used to report status on the rebuild

rdm_dbRebuildKeys()

RDM_RETCODE rdm_dbRebuildKeys ( RDM_DB db,
uint32_t numKeys,
const RDM_KEY_ID * keyId,
uint32_t reportFrequency,
RDM_REBUILD_INDEX_REPORT_FCN * fcn
)

#include <rdmdbapi.h>

Rebuild keys for one or more indexes.

This function allows an application to rebuild the indexes specified by keyId.

If reportFrequency is non-zero and fcn is not NULL, rdm_dbRebuildKeys() calls the report function pointed to by fcn every reportFrequency rows it has successfully processed.

Locking Requirements
The table for each key specified must be write locked.
Return values
sOKAY Normal, successful return.
eDBNOTOPEN Database not open.
eREADONLY Database is read-only and cannot be updated.
eNOSTARTUPDATE An update operation was attempted when no rdm_dbStartUpdate() is active.
eNOTLOCKED Attempt to access a table for reading or update without proper locks.
ePRECOMMITTED A precommitted transaction must be committed or rolled back before further operations on this database are allowed.
See also
rdm_dbStartUpdate
rdm_dbImport
rdm_dbEnd
rdm_dbRebuildKey
Parameters
[in] db A valid RaimaDB database handle
[in] numKeys The number of keys to rebuild
[in] keyId The RaimaDB key identifier
[in] reportFrequency how often to report status on the rebuild
[in] fcn A function used to report status on the rebuild

rdm_dbVacuum()

RDM_RETCODE rdm_dbVacuum ( RDM_DB db,
const char * optString
)

#include <rdmdbapi.h>

Database vacuum API.

This API vacuums delete data from the disk-based database pack files.

This function is located in RaimaDB DB Engine Library. Linker option:

    -lrdmrdm
Locking Requirements
None
Return values
sOKAY Normal, successful return.
eDBNOTOPEN Database not open.
See also
rdm_dbSetOptions
rdm_dbCreateNewPackFile
rdm-vacuum
Parameters
[in] db A valid RaimaDB database handle
[in] optString A semicolon delimited string that contains the utility options