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

Collaboration diagram for Utility functions:

Functions

RDM_RETCODE rdm_dbExport (RDM_DB db, const RDM_TCHAR_T *optString)
Database export API. More...
RDM_RETCODE rdm_dbVacuum (RDM_DB db, const RDM_TCHAR_T *optString)
Database vacuum API. More...
RDM_RETCODE rdm_dbFlushIdIndex (RDM_DB db)
Flush the database ID Index. More...
RDM_RETCODE rdm_dbRebuildIdIndex (RDM_DB db)
Rebuild the database ID Index. More...
RDM_RETCODE rdm_dbCreateNewPackFile (RDM_DB db)
Create a new pack file. More...
RDM_RETCODE rdm_dbImport (RDM_DB db, const RDM_TCHAR_T *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_dbFlushIdIndex
rdm_dbVacuum
rdm-vacuum
Parameters
[in] db [in] A valid RDM database handle

rdm_dbExport()

RDM_RETCODE rdm_dbExport ( RDM_DB db,
const RDM_TCHAR_T * optString
)

#include <rdmdbapi.h>

Database export API.

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

For CSV export the rdm_dbExport() API writes all data from each table to a separate file; it is the table name with file extension .txt. If a table name, is specified, then only that table's rows are exported. The created files will consist of one text line per row occurrence with a separator characters separating the columns.

The CSV export has two ways of printing extended ASCII characters to the output files. The default is to write out the octal value. Since rdm_dbImport() cannot handle this method, the extended option can be used to print the extended ASCII character as the character. For example, ASCII 2 would be printed as "\002" without the extended and as a smiley face with the extended option.

For XML exports the rdm_dbExport() API writes all data from the database to an XML file. By exporting data into XML format, consumers of the data can be RDM (e.g. for database archiving), RDM Server, or other XML consumers, including other database products such as ADO.NET. The XML content created by the rdm_dbExport() API will allow reconstruction of sets (in the case of RDM as the consumer), or interpretation by any normal XML consumer.

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 Database not open.
See also
rdm_dbStartRead
rdm_dbStartSnapshot
rdm_dbStartUpdate
rdm_dbImport
rdm_dbPersistInMemory
rdm_dbEnd
Parameters
[in] db [in] A valid RDM database handle
[in] optString [in] A semicolon delimited string that contains the utility options

rdm_dbFlushIdIndex()

RDM_RETCODE rdm_dbFlushIdIndex ( RDM_DB db )

#include <rdmdbapi.h>

Flush the database ID Index.

This API forces all changes to a databases ID Index to be flushed to disk. Typically the ID Index is flushed when a number of changes have been made, but this can force the ID Index to be flushed immediately.

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_dbVacuum
rdm-vacuum
Parameters
[in] db [in] A valid RDM database handle

rdm_dbImport()

RDM_RETCODE rdm_dbImport ( RDM_DB db,
const RDM_TCHAR_T * optString
)

#include <rdmdbapi.h>

Database import API.

This API imports data from text files to database tables. The import functionality is simple enough to allow great quantities of raw ASCII/XML data to be entered into an RDM database with very little specification. With more complex requirements, rdm_dbImport() can be instructed to perform mappings between the input data and table rows/columns.

For CSV imports all instructions to rdm_dbImport() are placed into a text file in the form of an import specification language (ISL). An ISL specification identifies the database and the files containing ASCII data to be imported. It also contains mappings between ASCII data fields and the RDM tables.

For XML imports the XML document must be in the format supported be the RDM engine. The RDM rdm_dbExport() API will create an XML document that is in the correct format for rdm_dbImport(). See the documentation on the XML format for full details.

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 [in] A valid RDM database handle
[in] optString [in] A semicolon delimited string that contains the utility options

rdm_dbRebuildIdIndex()

RDM_RETCODE rdm_dbRebuildIdIndex ( RDM_DB db )

#include <rdmdbapi.h>

Rebuild the database ID Index.

This API forces a complete rebuild of the ID Index of an on-disk database. It is a no-op for an in-memory database.

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_dbVacuum
rdm-vacuum
Parameters
[in] db [in] A valid RDM database handle

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 [in] A valid RDM database handle
[in] keyId [in] The RDM key identifier
[in] reportFrequency [in] how often to report status on the rebuild
[in] fcn [in] 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 [in] A valid RDM database handle
[in] numKeys [in] The number of keys to rebuild
[in] keyId [in] The RDM key identifier
[in] reportFrequency [in] how often to report status on the rebuild
[in] fcn [in] A function used to report status on the rebuild

rdm_dbVacuum()

RDM_RETCODE rdm_dbVacuum ( RDM_DB db,
const RDM_TCHAR_T * 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_dbFlushIdIndex
rdm_dbCreateNewPackFile
rdm-vacuum
Parameters
[in] db [in] A valid RDM database handle
[in] optString [in] A semicolon delimited string that contains the utility options