📄 dba.h
字号:
*/Boolean_t DBA_TableExists( const char* TableName );/** * Define a binding between the columns of a table and a C structure. * * @param TableName table * @param NbCol number of columns bindings * @param ColBinding bindings * @param StructSz Sizeof structure. * @return Created binding, or NULL if binding could not be created. */DBA_Binding_t*DBA_CreateBinding( const char* TableName, int NbCol, const DBA_ColumnBinding_t ColsBinding[], Size_t StructSz );/** * Destroys a @ref DBA_Binding_t allocated with @ref * DBA_CreateBinding. * * @param pBinding Pointer to binding. * @return Status. */DBA_Error_t DBA_DestroyBinding( DBA_Binding_t* Binding );/** * Used to identify a pending db request */typedef long DBA_ReqId_t;/** * An asynchronous call returning this means that the function was called * with invalid arguments. The application should check error status * with DBA_GetLatestError() etc. */#define DBA_INVALID_REQID 0/** * Callback function for transactions. * Will be called in NBP process (Newton Batch Process). * * @note The implementation of the callback function is not allowed to * make an asynchronous database call. * * @param ReqId Request identifier * @param Status Status of the request * @param ErrorCode Error code given by NDB * @see DBA_Error_t */typedef void (*DBA_AsyncCallbackFn_t)( DBA_ReqId_t ReqId, DBA_Error_t Status, DBA_ErrorCode_t ErrorCode );/** * Insert row(s) in the table (one transaction) * * @param pBinding Binding between table columns and struct fields. * @param pData Array of pointers to structures. * @param NbRows No of rows to insert (i.e. length of pData array) * @return Request identifier * * @note All the table columns must be part of the binding. */DBA_ReqId_tDBA_InsertRows( const DBA_Binding_t* pBinding, const void * const pData[], int NbRows, DBA_AsyncCallbackFn_t CbFunc );/** * Insert row(s) in the table (one transaction) * * @param pBinding Binding between table columns and struct fields. * @param pData Array of structures. * @param NbRows No of rows to insert (i.e. length of pData array) * @return Request identifier * * @note All the table columns must be part of the binding. */DBA_ReqId_tDBA_ArrayInsertRows( const DBA_Binding_t* pBinding, const void * pData, int NbRows, DBA_AsyncCallbackFn_t CbFunc );/** * Update row(s) in the table (one transaction) * * @param pBinding Binding between table columns and struct fields. * @param pData Array of pointers to structures. Fields that are part of the * key are used to generate the where clause, the * other fields are used to update the row. * @param NbRows No of rows to update (i.e. length of pData array). * @return Request identifier */DBA_ReqId_tDBA_UpdateRows( const DBA_Binding_t* pBinding, const void * const pData[], int NbRows, DBA_AsyncCallbackFn_t CbFunc );/** * Update row(s) in the table (one transaction) * * @param pBinding Binding between table columns and struct fields. * @param pData Array of structures. Fields that are part of the * key are used to generate the where clause, the * other fields are used to update the row. * @param NbRows No of rows to update (i.e. length of pData array). * @return Request identifier */DBA_ReqId_tDBA_ArrayUpdateRows( const DBA_Binding_t* pBinding, const void * pData, int NbRows, DBA_AsyncCallbackFn_t CbFunc );/** * Delete row(s) from the table (one transaction) * * @param pBinding Binding between table columns and struct fields. * @param pData Array of pointers to structures. * Only fields part of the primary key needs to be set. * @param NbRows No of rows to delete (i.e. length of pData array) * @return Request identifier */DBA_ReqId_tDBA_DeleteRows( const DBA_Binding_t* pBinding, const void * const pData[], int NbRows, DBA_AsyncCallbackFn_t CbFunc );/** * Delete row(s) from the table (one transaction) * * @param pBinding Binding between table columns and struct fields. * @param pData Array of structures. Only fields part of the primary * key needs to be set. * @param NbRows No of rows to delete (i.e. length of pData array) * @return Request identifier */DBA_ReqId_tDBA_ArrayDeleteRows( const DBA_Binding_t* pBinding, const void * pData, int NbRows, DBA_AsyncCallbackFn_t CbFunc );/** * Updates/Inserts row(s) in the table (one transaction) * * @param pBinding Binding between table columns and struct fields. * @param pData Array of pointers to structures. * @param NbRows No of rows to update/insert (i.e. length of pData array) * @return Request identifier * @note All the table columns must be part of the binding. */DBA_ReqId_tDBA_WriteRows( const DBA_Binding_t* pBinding, const void * const pData[], int NbRows, DBA_AsyncCallbackFn_t CbFunc );/** * Update/Insert row(s) in the table (one transaction) * * @param pBinding Binding between table columns and struct fields. * @param pData Array of structures. * @param NbRows No of rows to update/insert (i.e. length of pData array) * @return Request identifier * @note All the table columns must be part of the binding. */DBA_ReqId_tDBA_ArrayWriteRows( const DBA_Binding_t* pBinding, const void * pData, int NbRows, DBA_AsyncCallbackFn_t CbFunc );/** * Read row(s) from a table of the database (one transaction) * * @param pBinding Binding between table columns and struct fields. * @param pData Array of pointers to structures. * Only fields part of the primary key needs to be set. * The other fields in the binding will be populated. * @param NbRows No of rows to read (i.e. length of pData array) * @return Request identifier */DBA_ReqId_tDBA_ReadRows( const DBA_Binding_t* pBinding, void * const pData[], int NbRows, DBA_AsyncCallbackFn_t CbFunc );/** * Read row(s) from a table of the database (one transaction) * * @param pBinding Binding between table columns and struct fields. * @param pData Array of structures. * Only fields part of the primary key needs to be set. * The other fields in the binding will be populated. * @param NbRows No of rows to read (i.e. length of pData array) * @return Request identifier */DBA_ReqId_tDBA_ArrayReadRows( const DBA_Binding_t* pBinding, void * pData, int NbRows, DBA_AsyncCallbackFn_t CbFunc );/****** THIS LINE IS 80 CHARACTERS WIDE - DO *NOT* EXCEED 80 CHARACTERS! ****//** * Insert <b>one</b> row for each specified binding (as one transaction). * * @param pBindings Array of pointers to bindings. * @param pData Array of pointers to structures. * @param NbBindings No of bindings (tables) to insert into, * i.e. length of arrays pBindings and pData * @return Request identifier * @note It is valid to specify the same binding twice * (with corresponding data pointer) if you want to insert two * rows in one table */DBA_ReqId_tDBA_MultiInsertRow(const DBA_Binding_t * const pBindings[], const void * const pData[], int NbBindings, DBA_AsyncCallbackFn_t CbFunc );/** * Update <b>one</b> row for each specified binding (as one transaction). * * @param pBindings Array of pointers to bindings. * @param pData Array of pointers to structures. * @param NbBindings No of bindings (tables) to insert into * i.e. length of arrays pBindings and pData * @return Request identifier * @note It is valid to specify the same binding twice * (with corresponding data pointer) if you want to update two * rows in one table */DBA_ReqId_tDBA_MultiUpdateRow(const DBA_Binding_t * const pBindings[], const void * const pData[], int NbBindings, DBA_AsyncCallbackFn_t CbFunc );/** * Update/insert <b>one</b> row for each specified binding (as one transaction). * * @param pBindings Array of pointers to bindings. * @param pData Array of pointers to structures. * @param NbBindings No of bindings (tables) to insert into * i.e. length of arrays pBindings and pData * @return Request identifier * @note It is valid to specify the same binding twice * (with corresponding data pointer) if you want to update/insert two * rows in one table */DBA_ReqId_tDBA_MultiWriteRow(const DBA_Binding_t * const pBindings[], const void * const pData[], int NbBindings, DBA_AsyncCallbackFn_t CbFunc );/** * Delete <b>one</b> row for each specified binding (as one transaction). * * @param pBindings Array of pointers to bindings. * @param pData Array of pointers to structures. * @param NbBindings No of bindings (tables) to insert into * i.e. length of arrays pBindings and pData * @return Request identifier * @note It is valid to specify the same binding twice * (with corresponding data pointer) if you want to delete two * rows in one table */DBA_ReqId_tDBA_MultiDeleteRow(const DBA_Binding_t * const pBindings[], const void * const pData[], int NbBindings, DBA_AsyncCallbackFn_t CbFunc );/** * Read <b>one</b> row for each specified binding (as one transaction). * * @param pBindings Array of pointers to bindings. * @param pData Array of pointers to structures. * @param NbBindings No of bindings (tables) to insert into * i.e. length of arrays pBindings and pData * @return Request identifier * @note It is valid to specify the same binding twice * (with corresponding data pointer) if you want to read two * rows in one table */DBA_ReqId_tDBA_MultiReadRow(const DBA_Binding_t * const pBindings[], void * const pData[], int NbBindings, DBA_AsyncCallbackFn_t CbFunc );/****** THIS LINE IS 80 CHARACTERS WIDE - DO *NOT* EXCEED 80 CHARACTERS! ****//** * A structure used for bulk reads. * The structure contains a pointer to the data and an indicator. * After the bulk read has completed, the indicator is set to 1 if the row * was found and to 0 if the row was not found. * */typedef struct DBA_BulkReadResultSet { void * DataPtr; /**< Pointer to data. Only fields part of primary key members needs to be set before bulk read. */ Boolean_t RowFoundIndicator; /**< This indicator has a valid value only after bulk read has completed. If the value is 1 then the row was found */} DBA_BulkReadResultSet_t;/** * Read rows from a table of the database (potentially multiple transactions) * The users should for each NbRows specify the fields part of the primary key * * @param pBinding Binding between table columns and struct fields. * @param pData Array of DBA_BulkReadResultSet_t, with DataPtr pointing to * structure. Only the fields which are part of the * primary key need be set. * The RowFoundIndicator will be set when the request returns. * @param NbRows No of rows to read (i.e. length of pData array) * @return Request identifier * */DBA_ReqId_tDBA_BulkReadRows(const DBA_Binding_t * pBinding, DBA_BulkReadResultSet_t pData[], int NbRows, DBA_AsyncCallbackFn_t CbFunc );/** * Read rows from several tables of the database in potentially multiple * transactions. * *<pre> * The pData array <b>must</b> be organized as follows: * NbRows with DataPtr pointing to structure of type pBindings[0] * NbRows with DataPtr pointing to structure of type pBindings[1] * ... </pre> * Meaning that the pData array must be (NbBindings * NbRows) in length. * * The user should for each (NbRows * NbBindings) specify the primary key * fields. * * @param pBindings Array of pointers to bindings * @param pData Array of DBA_BulkReadResultSet_t. * With DataPtr pointing to structure. Only the fields which * are part of the key need be set. * The RowFoundIndicator will be set when the operations returns. * @param NbBindings No of bindings (i.e. length of pBindings array) * @param NbRows No of rows per binding to read * @return Request identifier */DBA_ReqId_tDBA_BulkMultiReadRows(const DBA_Binding_t * const pBindings[], DBA_BulkReadResultSet_t pData[], int NbBindings, int NbRows, DBA_AsyncCallbackFn_t CbFunc );/** @} */#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -