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 RDM 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 RDM 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 RDM 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.

Key Value Description
force Overwrite an existing export output file.
nocolumnlist Do not include the list of columns in the generated SQL INSERT statement.
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 Name of the specific table for which to export data.
triggersonly Export only the triggers (SQL export only).
type Export file type (XML, CSV, SQL, CAT or STAT).
query Export the data specified by the SQL query.
usesnapshot Start a snapshot to read the content of the database.

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

    -lrdmexport
Locking Requirements
Read locks on the tables being exported.
Return values
sOKAY Normal, successful return.
{eDBNOTOPEN
Parameters
[in] db A valid RDM 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 from comma-separated (CSV), XML or SQL formatted text files into an existing database.

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, like: 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.

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

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

    -lrdmexport
Locking Requirements
Write locks on the tables being imported.
Return values
sOKAY Normal, successful return.
eDBNOTOPEN Database not open.
See also
rdm_dbStartUpdate
rdm_dbExport
rdm_dbEnd
Parameters
[in] db A valid RDM 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 RDM database handle
[in] keyId The RDM 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 RDM database handle
[in] numKeys The number of keys to rebuild
[in] keyId The RDM 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 RDM 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 RDM database handle
[in] optString A semicolon delimited string that contains the utility options