Functions | |
RDM_RETCODE | rdm_dbInsertRow (RDM_DB db, RDM_TABLE_ID tableId, const void *colValues, size_t bytesIn, RDM_CURSOR *pCursor) |
Insert a new row into a table at the specified rowId. More... | |
RDM_RETCODE | rdm_dbInsertRows (RDM_DB db, RDM_TABLE_ID tableId, const void *colValues, size_t bytesIn, uint32_t num, RDM_CURSOR *pCursorStatus, RDM_CURSOR *pCursor) |
Insert rows into a table. More... | |
RDM_RETCODE | rdm_dbReinsertRow (RDM_DB db, RDM_TABLE_ID tableId, RDM_ROWID_T rowId, const void *colValues, size_t bytesIn, RDM_CURSOR *pCursor) |
Insert a new row into a table. More... | |
Cursor association API for inserting rows. All the functions here are located in RDM DB Engine Library. Linker option:
-lrdmrdm
RDM_RETCODE rdm_dbInsertRow | ( | RDM_DB | db, |
RDM_TABLE_ID | tableId, | ||
const void * | colValues, | ||
size_t | bytesIn, | ||
RDM_CURSOR * | pCursor | ||
) |
#include <rdmdbapi.h>
Insert a new row into a table at the specified rowId.
This function adds a new row to the table specified by tableId. It can optionally associate the RDM_CURSOR pointed to by pCursor with a singleton containing the inserted row.
The row will be created in the table specified by tableId.
The engine validates the size of the buffers prior to accessing them.
For each column that is not designated as NOT NULL a _has_value
field is added to the structure. If the _has_value
field for a column is not set (RDM_COL_IS_NULL), then the value for the column will be considered NULL and anything in the structure value field for the column will be ignored. If the column has data, the _has_value
field should be set to RDM_COL_HAS_VALUE.
sOKAY | Normal, successful return. |
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. |
eCURSORDB | Cursor is associated with a different database. |
eDBNOTOPEN | Database not open. |
ePRECOMMITTED | A precommitted transaction must be committed or rolled back before further operations on this database are allowed. |
eDUPLICATE | Attempt to insert a duplicate value as a unique/primary key. |
eREADONLY | Database is read-only and cannot be updated. |
eREFINTEGRITY | Integrity constraint violation. |
eROWLIMIT | Table row limit reached. |
[in] | db | A valid RDM database handle |
[in] | tableId | The table identifier for table to insert the row into |
[in] | colValues | A buffer that contains the column values of the row to be inserted formatted as the table structure generated when the database schema was compiled. If the table definition has changed since the schema was first compiled a new header file will need to be generated. |
[in] | bytesIn | The length of the colValues buffer. If colValues is NULL this value should be 0. |
[out] | pCursor | A optional pointer to an RDM_CURSOR (must be allocated, associated with db, or set to NULL) |
Referenced by RDM::TIME_SERIES::insert_row< table_id >::put_value().
RDM_RETCODE rdm_dbInsertRows | ( | RDM_DB | db, |
RDM_TABLE_ID | tableId, | ||
const void * | colValues, | ||
size_t | bytesIn, | ||
uint32_t | num, | ||
RDM_CURSOR * | pCursorStatus, | ||
RDM_CURSOR * | pCursor | ||
) |
#include <rdmdbapi.h>
Insert rows into a table.
This function inserts rows to the table specified by tableId.
If pCursor is not NULL the RDM_CURSOR pointed to by pCursor will be associated with the collection of inserted rows. In the case that there are errors inserting there may be fewer rows in the resulting RDM_CURSOR than num.
If pCursorStatus is not NULL the RDM_CURSOR pointed to by pCursorStatus will be associated with a set of RDM_RETCODE values pertaining to the status of each row that was to be inserted into the table.
For each column that is not designated as NOT NULL a _has_value
field is added to the table structure. If the _has_value
field for a column is not set the value for the column will be considered NULL and anything in the structure value field for the column will be ignored.
sOKAY | Normal, successful return. |
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. |
eCURSORDB | Cursor is associated with a different database. |
eDBNOTOPEN | Database not open. |
ePRECOMMITTED | A precommitted transaction must be committed or rolled back before further operations on this database are allowed. |
eDUPLICATE | Attempt to insert a duplicate value as a unique/primary key. |
eREFINTEGRITY | Integrity constraint violation. |
eREADONLY | Database is read-only and cannot be updated. |
eROWLIMIT | Table row limit reached. |
sOKAYWITHINFO | Successful return with info. One or more of the inserted rows failed to be inserted. Iterate pCursorStatus to retreve the individual statuses by calling rdm_cursorGetRowStatus |
[in] | db | A valid RDM database handle |
[in] | tableId | The table identifier for table to insert the row into |
[in] | colValues | An array that contains the column values of the rows to be inserted formatted as an array of the table structure generated when the database schema was compiled. If the table definition has changed since the schema was first compiled a new header file will need to be generated. |
[in] | bytesIn | The size of the colValues buffer (in bytes) |
[in] | num | The number of array entries (the number of row to be added to the table |
[out] | pCursorStatus | A pointer to an RDM_CURSOR (must be allocated, associated with db, or set to NULL). There will be one RDM_RETCODE value for each row that was attempted to be added to the table. This parameter can be NULL |
[out] | pCursor | A pointer to an RDM_CURSOR (must be allocated, associated with db, or set to NULL). This will contain a collection of all the rows that were inserted. This parameter can be NULL. |
RDM_RETCODE rdm_dbReinsertRow | ( | RDM_DB | db, |
RDM_TABLE_ID | tableId, | ||
RDM_ROWID_T | rowId, | ||
const void * | colValues, | ||
size_t | bytesIn, | ||
RDM_CURSOR * | pCursor | ||
) |
#include <rdmdbapi.h>
Insert a new row into a table.
This function adds a new row to the table specified by tableId at the specified rowId. It can optionally associate the RDM_CURSOR pointed to by pCursor with a singleton containing the inserted row.
The row will be created in the table specified by tableId.
The row will be placed in the specified rowId location. An error will be returned if that rowId already as a row associated with it or if the rowId is greater than the total number of rows currently in the table.
The engine validates the size of the buffers prior to accessing them.
For each column that is not designated as NOT NULL a _has_value
field is added to the structure. If the _has_value
field for a column is not set (RDM_COL_IS_NULL), then the value for the column will be considered NULL and anything in the structure value field for the column will be ignored. If the column has data, the _has_value
field should be set to RDM_COL_HAS_VALUE.
sOKAY | Normal, successful return. |
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. |
eCURSORDB | Cursor is associated with a different database. |
eDBNOTOPEN | Database not open. |
ePRECOMMITTED | A precommitted transaction must be committed or rolled back before further operations on this database are allowed. |
eDUPLICATE | Attempt to insert a duplicate value as a unique/primary key. |
eREADONLY | Database is read-only and cannot be updated. |
eREFINTEGRITY | Integrity constraint violation. |
eROWLIMIT | Table row limit reached. |
[in] | db | A valid RDM database handle |
[in] | tableId | The table identifier for table to insert the row into |
[in] | rowId | The rowid to be assigned to the row |
[in] | colValues | A buffer that contains the column values of the row to be inserted formatted as the table structure generated when the database schema was compiled. If the table definition has changed since the schema was first compiled a new header file will need to be generated. |
[in] | bytesIn | The length of the colValues buffer. If colValues is NULL this value should be 0. |
[out] | pCursor | A optional pointer to an RDM_CURSOR (must be allocated, associated with db, or set to NULL) |