Database Information Functions
Collaboration diagram for Database Information Functions:

Functions

RDM_RETCODE rdm_dbGetMemoryUsage (RDM_DB db, uint64_t *systemCurr, uint64_t *systemMax, uint64_t *userCurr, uint64_t *userMax)
Get memory usage information for a database. More...
RDM_RETCODE rdm_dbGetInfo (RDM_DB db, const char *keyword, char *infoString, size_t bytesIn, size_t *bytesOut)
Get RaimaDB database information. More...
RDM_RETCODE rdm_dbGetTFS (RDM_DB db, RDM_TFS *pTFS)
Get the RDM_TFS handle associated with a db. More...
RDM_RETCODE rdm_dbGetTFSType (RDM_DB db, TFS_TYPE *pTfsType)
Get the type of the RDM_TFS handle associated with a database. More...
RDM_RETCODE rdm_dbFindTableIdByName (RDM_DB db, const char *tableName, RDM_TABLE_ID *pTableId)
Find the ID of the table specified by the name. More...
RDM_RETCODE rdm_dbFindColumnIdByName (RDM_DB db, RDM_TABLE_ID tableId, const char *columnName, RDM_COLUMN_ID *pColumnId)
Find the ID of the column specified by the name. More...
RDM_RETCODE rdm_dbFindColumnIdsForTable (RDM_DB db, RDM_TABLE_ID tableId, RDM_COLUMN_INFO *pColumns, uint16_t numColumnsIn, uint16_t *pNumColumnsOut)
Retrieve the list of column IDs for the specified table. More...
RDM_RETCODE rdm_dbFindPrimaryKeyIdByTableId (RDM_DB db, RDM_TABLE_ID tableId, RDM_KEY_ID *pKeyId)
Find the ID of the primary key of the table specified by the table ID. More...
RDM_RETCODE rdm_dbGetCertificate (RDM_DB db, char *certificate_info, size_t sizeIn, size_t *sizeOut)
Retrieve the information about the SSL certificate. More...

Detailed Description

API for retrieving the TFS information for a database. All the functions here are located in RaimaDB DB Engine Library. Linker option:

    -lrdmrdm

Function Documentation

rdm_dbFindColumnIdByName()

RDM_RETCODE rdm_dbFindColumnIdByName ( RDM_DB db,
RDM_TABLE_ID tableId,
const char * columnName,
RDM_COLUMN_ID * pColumnId
)

#include <rdmdbapi.h>

Find the ID of the column specified by the name.

This function accepts a database handle, a table ID and a column name, and returns the corresponding ID for the column. The value of the returned column ID is identical to the enumerated value of the column assigned in the structure header file generated by rdm-compile.

Locking Requirements
None.
Return values
sOKAY Normal, successful return.
sNOTFOUND Requested item not found.
eDBNOTOPEN Database not open.
eINVNULLARG Function argument cannot be NULL.
eINVTABID Invalid table id.
Parameters
[in] db A valid RaimaDB database handle
[in] tableId ID of the table for which to retrieve the column ID
[in] columnName Name of a valid column that belongs to the table
[out] pColumnId ID of the specified column

rdm_dbFindColumnIdsForTable()

RDM_RETCODE rdm_dbFindColumnIdsForTable ( RDM_DB db,
RDM_TABLE_ID tableId,
RDM_COLUMN_INFO * pColumns,
uint16_t numColumnsIn,
uint16_t * pNumColumnsOut
)

#include <rdmdbapi.h>

Retrieve the list of column IDs for the specified table.

This function accepts a database handle and a table ID, and returns a list of column names and corresonding IDs available to the specified table. An RDM_COLUMN_INFO structure consists of name and ID fields. The values of the returned column IDs are identical to the enumerated values of the columns assigned in the structure header file generated by rdm-compile.

If pColumns is NULL, the function returns the number of available columns to the specified table in pNumColumnsOut. If both a\ pColumns and pNumColumnsOut are NULL, the function returns eINVNULLARG.

Remarks
If the table has fewer columns than specified in numColumns, the function returns the name and IDs of all columns in the table, leaving the remaining elements of pColumns untouched. If the table has more columns than specified, the function returns sTRUNCATE and fills the pColumns array up to numColumnsIn elements.
Return values
sOKAY Normal, successful return.
sTRUNCATE Result is truncated.
eDBNOTOPEN Database not open.
eINVNULLARG Function argument cannot be NULL.
eINVTABID Invalid table id.
Parameters
[in] db A valid RaimaDB database handle
[in] tableId ID of the table for which to retrieve the column ID
[in] pColumns Array of the column information structure
[in] numColumnsIn Number of columns
pNumColumnsOut K [out] Actual number of columns returned

rdm_dbFindPrimaryKeyIdByTableId()

RDM_RETCODE rdm_dbFindPrimaryKeyIdByTableId ( RDM_DB db,
RDM_TABLE_ID tableId,
RDM_KEY_ID * pKeyId
)

#include <rdmdbapi.h>

Find the ID of the primary key of the table specified by the table ID.

This function accepts a database handle and a table ID, and returns the ID of the primary key of that table. The value of the returned primary key ID is identical to the enumerated value of the primary key specified in the structure header file generated by rdm-compile.

Locking Requirements
None.
Return values
sOKAY Normal, successful return.
sNOTFOUND Requested item not found.
eDBNOTOPEN Database not open.
eINVNULLARG Function argument cannot be NULL.
eINVTABID Invalid table id.
Parameters
[in] db A valid RaimaDB database handle
[in] tableId RaimaDB table ID of the targettable
[out] pKeyId the primary key ID of the targettable

rdm_dbFindTableIdByName()

RDM_RETCODE rdm_dbFindTableIdByName ( RDM_DB db,
const char * tableName,
RDM_TABLE_ID * pTableId
)

#include <rdmdbapi.h>

Find the ID of the table specified by the name.

This function accepts a database handle and a table name, and returns the corresponding ID for the table. The value of the returned table ID is identical to the enumerated value of the table assigned in the structure header file generated by rdm-compile.

Locking Requirements
None.
Return values
sOKAY Normal, successful return.
sNOTFOUND Requested item not found.
eDBNOTOPEN Database not open.
eINVNULLARG Function argument cannot be NULL.
Parameters
[in] db A valid RaimaDB database handle
[in] tableName Name of a valid table that belongs to the database
[out] pTableId ID of the specified table

rdm_dbGetCertificate()

RDM_RETCODE rdm_dbGetCertificate ( RDM_DB db,
char * certificate_info,
size_t sizeIn,
size_t * sizeOut
)

#include <rdmdbapi.h>

Retrieve the information about the SSL certificate.

The certificate is returned in PEM format, base64 encoded.

If certificate_info is NULL, the function returns the size in in bytes needed in certificate_out. The size includes the space for a null terminator.

If both a\ certificate_info and certificate_out are NULL, the function returns eINVNULLARG.

Remarks
If the retrieved certificate is larger than sizeIn, the function returns sTRUNCATE and fills the certificate_info buffer up to sizeIn - 1 bytes, terminating the buffer with a null terminator.
Locking Requirements
None.
Return values
sOKAY Normal, successful return.
Parameters
[in] db A valid RaimaDB database handle
[out] certificate_info Information about the server-side certificate
[in] sizeIn Size in bytes of certificate_info
[out] sizeOut Size in bytes needed/used for certificate_out
Examples
core40Example_main.c.

rdm_dbGetInfo()

RDM_RETCODE rdm_dbGetInfo ( RDM_DB db,
const char * keyword,
char * infoString,
size_t bytesIn,
size_t * bytesOut
)

#include <rdmdbapi.h>

Get RaimaDB database information.

This function returns information in various categories about the TFS. The information will be returned in JSON format via the provided buffer.

The valid key/value options are:

Key Description
drawers=true/false If true, list the drawer info about the database

will be retrieved. | | users=true/false | If true, list the current users accessing the database. | | pack=all | Return list of pack files. | | trans=count_or_range | One or two numbers can be specified separated by comma. Specify 'count' or 'from,to'. |

The optString is a semicolon delimited list of keys to specifiy the information to be retrieved in the buffer. For example, "drawers=true;trans=25;users=true;pack=all" will retrieve the drawer list, 25 transactions, current user names, and list of pack files.

Return values
sOKAY Normal, successful return.
sTRUNCATE Result is truncated.
eINVOPTION Invalid option identifier is specified.
See also
rdm_tfsAllocDatabase
rdm_dbOpen
rdm_dbFree
rdm-info
Parameters
[in] db A valid RaimaDB database handle
[in] keyword An information keyword
[out] infoString information string
[in] bytesIn # of bytes for optString
[out] bytesOut result # of bytes

rdm_dbGetMemoryUsage()

RDM_RETCODE rdm_dbGetMemoryUsage ( RDM_DB db,
uint64_t * systemCurr,
uint64_t * systemMax,
uint64_t * userCurr,
uint64_t * userMax
)

#include <rdmdbapi.h>

Get memory usage information for a database.

This function retrieves memory usage information for a database

The memory usage is split between system memory which is memory that is used by the engine and user data which is memory used for storing the user data (rows, keys, blobs, schema, etc.).

For a disk based database the user memory usage will always be 0 as the data is stored on disk and not in-memory.

Both disk and in-memory databases require system memory.

Locking Requirements
None
Return values
sOKAY Normal, successful return.
eDBNOTOPEN Database not open.
Parameters
[in] db A valid RaimaDB database handle
[out] systemCurr The current amount of system memory in use for the database (does not include user data - rows, keys, etc.)
[out] systemMax The maximum total amount of system memory in use for the database (does not include user data - rows, keys, etc.)
[out] userCurr The current amount of memory for user data in the database
[out] userMax The maximum amount of memory for user data in the database

rdm_dbGetTFS()

RDM_RETCODE rdm_dbGetTFS ( RDM_DB db,
RDM_TFS * pTFS
)

#include <rdmdbapi.h>

Get the RDM_TFS handle associated with a db.

This function assigns the RDM_TFS handle associated with an RDM_DB to pTFS.

Locking Requirements
None.
Return values
sOKAY Normal, successful return.
See also
rdm_tfsAllocDatabase
rdm_dbOpen
rdm_dbGetTFSType
Parameters
[in] db A valid RaimaDB database handle
[out] pTFS A pointer to an RDM_TFS that will be assigned the TFS handle associated with db

rdm_dbGetTFSType()

RDM_RETCODE rdm_dbGetTFSType ( RDM_DB db,
TFS_TYPE * pTfsType
)

#include <rdmdbapi.h>

Get the type of the RDM_TFS handle associated with a database.

This function assigns the type of the RDM_TFS handle associated with an RDM_DB to pTfsType

Locking Requirements
None.
Return values
sOKAY Normal, successful return.
See also
rdm_tfsAllocDatabase
rdm_dbOpen
rdm_dbGetTFS
Parameters
[in] db A valid RaimaDB database handle
[out] pTfsType Type of TFS