MySQL 5.6.14 Source Code Document
|
Classes | |
struct | DBA_ColumnDesc |
struct | DBA_ColumnBinding |
struct | DBA_BulkReadResultSet |
Macros | |
#define | DBA_BINDING(ColName, Type, Struct, Field) |
#define | DBA_BINDING_PTR(Struct, Field, ColBindings, NbCBindings) |
#define | DBA_INVALID_REQID 0 |
Typedefs | |
typedef int | DBA_ErrorCode_t |
typedef struct DBA_ColumnDesc | DBA_ColumnDesc_t |
typedef struct DBA_ColumnBinding | DBA_ColumnBinding_t |
typedef struct DBA_Binding | DBA_Binding_t |
typedef long | DBA_ReqId_t |
typedef void(* | DBA_AsyncCallbackFn_t )(DBA_ReqId_t ReqId, DBA_Error_t Status, DBA_ErrorCode_t ErrorCode) |
typedef struct DBA_BulkReadResultSet | DBA_BulkReadResultSet_t |
Enumerations | |
enum | DBA_Error_t { DBA_NO_ERROR = 0, DBA_NOT_IMPLEMENTED = -1, DBA_NDB_ERROR = -2, DBA_ERROR = -3, DBA_APPLICATION_ERROR = 1, DBA_NO_DATA = 2, DBA_CONSTRAINT_VIOLATION = 3, DBA_SCHEMA_ERROR = 4, DBA_INSUFFICIENT_SPACE = 5, DBA_TEMPORARY_ERROR = 6, DBA_TIMEOUT = 7, DBA_OVERLOAD = 8, DBA_UNKNOWN_RESULT = 9 } |
enum | DBA_DataTypes_t { DBA_CHAR, DBA_INT } |
Functions | |
DBA_Error_t | DBA_SetParameter (int ParameterId, int Value) |
DBA_Error_t | DBA_GetParameter (int ParameterId, int *Value) |
DBA_Error_t | DBA_Open () |
DBA_Error_t | DBA_Close (void) |
DBA_Error_t | DBA_GetLatestError () |
DBA_ErrorCode_t | DBA_GetLatestNdbError () |
const char * | DBA_GetLatestErrorMsg () |
const char * | DBA_GetErrorMsg (DBA_Error_t) |
const char * | DBA_GetNdbErrorMsg (DBA_ErrorCode_t) |
DBA_Error_t | DBA_CreateTable (const char *TableName, int NbColumns, const DBA_ColumnDesc_t Columns[]) |
DBA_Error_t | DBA_DropTable (const char *TableName) |
Boolean_t | DBA_TableExists (const char *TableName) |
DBA_Binding_t * | DBA_CreateBinding (const char *TableName, int NbCol, const DBA_ColumnBinding_t ColsBinding[], Size_t StructSz) |
DBA_Error_t | DBA_DestroyBinding (DBA_Binding_t *Binding) |
DBA_ReqId_t | DBA_InsertRows (const DBA_Binding_t *pBinding, const void *const pData[], int NbRows, DBA_AsyncCallbackFn_t CbFunc) |
DBA_ReqId_t | DBA_ArrayInsertRows (const DBA_Binding_t *pBinding, const void *pData, int NbRows, DBA_AsyncCallbackFn_t CbFunc) |
DBA_ReqId_t | DBA_UpdateRows (const DBA_Binding_t *pBinding, const void *const pData[], int NbRows, DBA_AsyncCallbackFn_t CbFunc) |
DBA_ReqId_t | DBA_ArrayUpdateRows (const DBA_Binding_t *pBinding, const void *pData, int NbRows, DBA_AsyncCallbackFn_t CbFunc) |
DBA_ReqId_t | DBA_DeleteRows (const DBA_Binding_t *pBinding, const void *const pData[], int NbRows, DBA_AsyncCallbackFn_t CbFunc) |
DBA_ReqId_t | DBA_ArrayDeleteRows (const DBA_Binding_t *pBinding, const void *pData, int NbRows, DBA_AsyncCallbackFn_t CbFunc) |
DBA_ReqId_t | DBA_WriteRows (const DBA_Binding_t *pBinding, const void *const pData[], int NbRows, DBA_AsyncCallbackFn_t CbFunc) |
DBA_ReqId_t | DBA_ArrayWriteRows (const DBA_Binding_t *pBinding, const void *pData, int NbRows, DBA_AsyncCallbackFn_t CbFunc) |
DBA_ReqId_t | DBA_ReadRows (const DBA_Binding_t *pBinding, void *const pData[], int NbRows, DBA_AsyncCallbackFn_t CbFunc) |
DBA_ReqId_t | DBA_ArrayReadRows (const DBA_Binding_t *pBinding, void *pData, int NbRows, DBA_AsyncCallbackFn_t CbFunc) |
DBA_ReqId_t | DBA_MultiInsertRow (const DBA_Binding_t *const pBindings[], const void *const pData[], int NbBindings, DBA_AsyncCallbackFn_t CbFunc) |
DBA_ReqId_t | DBA_MultiUpdateRow (const DBA_Binding_t *const pBindings[], const void *const pData[], int NbBindings, DBA_AsyncCallbackFn_t CbFunc) |
DBA_ReqId_t | DBA_MultiWriteRow (const DBA_Binding_t *const pBindings[], const void *const pData[], int NbBindings, DBA_AsyncCallbackFn_t CbFunc) |
DBA_ReqId_t | DBA_MultiDeleteRow (const DBA_Binding_t *const pBindings[], const void *const pData[], int NbBindings, DBA_AsyncCallbackFn_t CbFunc) |
DBA_ReqId_t | DBA_MultiReadRow (const DBA_Binding_t *const pBindings[], void *const pData[], int NbBindings, DBA_AsyncCallbackFn_t CbFunc) |
DBA_ReqId_t | DBA_BulkReadRows (const DBA_Binding_t *pBinding, DBA_BulkReadResultSet_t pData[], int NbRows, DBA_AsyncCallbackFn_t CbFunc) |
DBA_ReqId_t | DBA_BulkMultiReadRows (const DBA_Binding_t *const pBindings[], DBA_BulkReadResultSet_t pData[], int NbBindings, int NbRows, DBA_AsyncCallbackFn_t CbFunc) |
#define DBA_BINDING | ( | ColName, | |
Type, | |||
Struct, | |||
Field | |||
) |
Used to simplify binding definitions. See DBA_ColumnBinding for example.
ColName | Name of column in db table |
Type | Column/field type. |
Struct | Structure |
Field | Field in structure |
#define DBA_BINDING_PTR | ( | Struct, | |
Field, | |||
ColBindings, | |||
NbCBindings | |||
) |
Used to simplify ptr binding definitions. See DBA_ColumnBinding for example.
#define DBA_INVALID_REQID 0 |
An asynchronous call returning this means that the function was called with invalid arguments. The application should check error status with DBA_GetLatestError() etc.
typedef void(* DBA_AsyncCallbackFn_t)(DBA_ReqId_t ReqId, DBA_Error_t Status, DBA_ErrorCode_t ErrorCode) |
Callback function for transactions. Will be called in NBP process (Newton Batch Process).
ReqId | Request identifier |
Status | Status of the request |
ErrorCode | Error code given by NDB |
typedef struct DBA_Binding DBA_Binding_t |
A DBA_Binding_t object is used to establish a binding between one or more columns of a table to the fields of C structs.
It is used with insert, and update and read transactions to define on which columns of the table the operations is performed, and to which members of a C data structure they map.
All key columns must be bound to a field of the struct.
The function DBA_CreateBinding is used to create this binding.
typedef struct DBA_BulkReadResultSet DBA_BulkReadResultSet_t |
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_ColumnBinding DBA_ColumnBinding_t |
Typedef: DBA_ColumnBinding
typedef struct DBA_ColumnDesc DBA_ColumnDesc_t |
Column description. Used for creating tables.
typedef int DBA_ErrorCode_t |
typedef long DBA_ReqId_t |
enum DBA_DataTypes_t |
enum DBA_Error_t |
Possible error status for DBA functions.
DBA_ReqId_t DBA_ArrayDeleteRows | ( | const DBA_Binding_t * | pBinding, |
const void * | pData, | ||
int | NbRows, | ||
DBA_AsyncCallbackFn_t | CbFunc | ||
) |
DBA_ReqId_t DBA_ArrayInsertRows | ( | const DBA_Binding_t * | pBinding, |
const void * | pData, | ||
int | NbRows, | ||
DBA_AsyncCallbackFn_t | CbFunc | ||
) |
DBA_ReqId_t DBA_ArrayReadRows | ( | const DBA_Binding_t * | pBinding, |
void * | pData, | ||
int | NbRows, | ||
DBA_AsyncCallbackFn_t | CbFunc | ||
) |
Read row(s) from a table of the database (one transaction)
pBinding | Binding between table columns and struct fields. |
pData | Array of structures. Only fields part of the primary key needs to be set. The other fields in the binding will be populated. |
NbRows | No of rows to read (i.e. length of pData array) |
DBA_ReqId_t DBA_ArrayUpdateRows | ( | const DBA_Binding_t * | pBinding, |
const void * | pData, | ||
int | NbRows, | ||
DBA_AsyncCallbackFn_t | CbFunc | ||
) |
Update row(s) in the table (one transaction)
pBinding | Binding between table columns and struct fields. |
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. |
NbRows | No of rows to update (i.e. length of pData array). |
DBA_ReqId_t DBA_ArrayWriteRows | ( | const DBA_Binding_t * | pBinding, |
const void * | pData, | ||
int | NbRows, | ||
DBA_AsyncCallbackFn_t | CbFunc | ||
) |
DBA_ReqId_t DBA_BulkMultiReadRows | ( | const DBA_Binding_t *const | pBindings[], |
DBA_BulkReadResultSet_t | pData[], | ||
int | NbBindings, | ||
int | NbRows, | ||
DBA_AsyncCallbackFn_t | CbFunc | ||
) |
Read rows from several tables of the database in potentially multiple transactions.
The pData array must be organized as follows: NbRows with DataPtr pointing to structure of type pBindings[0] NbRows with DataPtr pointing to structure of type pBindings[1] ...
Meaning that the pData array must be (NbBindings * NbRows) in length.
The user should for each (NbRows * NbBindings) specify the primary key fields.
pBindings | Array of pointers to bindings |
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. |
NbBindings | No of bindings (i.e. length of pBindings array) |
NbRows | No of rows per binding to read |
DBA_ReqId_t DBA_BulkReadRows | ( | const DBA_Binding_t * | pBinding, |
DBA_BulkReadResultSet_t | pData[], | ||
int | NbRows, | ||
DBA_AsyncCallbackFn_t | CbFunc | ||
) |
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
pBinding | Binding between table columns and struct fields. |
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. |
NbRows | No of rows to read (i.e. length of pData array) |
DBA_Error_t DBA_Close | ( | void | ) |
Close connection to NDB cluster and free allocated memory.
DBA_Binding_t* DBA_CreateBinding | ( | const char * | TableName, |
int | NbCol, | ||
const DBA_ColumnBinding_t | ColsBinding[], | ||
Size_t | StructSz | ||
) |
Define a binding between the columns of a table and a C structure.
TableName | table |
NbCol | number of columns bindings |
ColBinding | bindings |
StructSz | Sizeof structure. |
DBA_Error_t DBA_CreateTable | ( | const char * | TableName, |
int | NbColumns, | ||
const DBA_ColumnDesc_t | Columns[] | ||
) |
Create a table.
TableName | Name of table to create. |
NbColumns | numbers of columns. |
Columns | Column descriptions. |
DBA_ReqId_t DBA_DeleteRows | ( | const DBA_Binding_t * | pBinding, |
const void *const | pData[], | ||
int | NbRows, | ||
DBA_AsyncCallbackFn_t | CbFunc | ||
) |
DBA_Error_t DBA_DestroyBinding | ( | DBA_Binding_t * | Binding | ) |
Destroys a DBA_Binding_t allocated with DBA_CreateBinding.
pBinding | Pointer to binding. |
DBA_Error_t DBA_DropTable | ( | const char * | TableName | ) |
Destroy a table.
TableName | Table name. |
const char* DBA_GetErrorMsg | ( | DBA_Error_t | ) |
Get error msg associated with code
DBA_Error_t DBA_GetLatestError | ( | ) |
Get latest DBA error.
const char* DBA_GetLatestErrorMsg | ( | ) |
Get latest error string associated with DBA_GetLatestError().
DBA_ErrorCode_t DBA_GetLatestNdbError | ( | ) |
Get latest NDB error.
const char* DBA_GetNdbErrorMsg | ( | DBA_ErrorCode_t | ) |
Get error msg associated with code
DBA_Error_t DBA_GetParameter | ( | int | ParameterId, |
int * | Value | ||
) |
Set DBA configuration parameter. See DBA_SetParameter for description of parameters.
DBA_ReqId_t DBA_InsertRows | ( | const DBA_Binding_t * | pBinding, |
const void *const | pData[], | ||
int | NbRows, | ||
DBA_AsyncCallbackFn_t | CbFunc | ||
) |
DBA_ReqId_t DBA_MultiDeleteRow | ( | const DBA_Binding_t *const | pBindings[], |
const void *const | pData[], | ||
int | NbBindings, | ||
DBA_AsyncCallbackFn_t | CbFunc | ||
) |
Delete one row for each specified binding (as one transaction).
pBindings | Array of pointers to bindings. |
pData | Array of pointers to structures. |
NbBindings | No of bindings (tables) to insert into i.e. length of arrays pBindings and pData |
DBA_ReqId_t DBA_MultiInsertRow | ( | const DBA_Binding_t *const | pBindings[], |
const void *const | pData[], | ||
int | NbBindings, | ||
DBA_AsyncCallbackFn_t | CbFunc | ||
) |
Insert one row for each specified binding (as one transaction).
pBindings | Array of pointers to bindings. |
pData | Array of pointers to structures. |
NbBindings | No of bindings (tables) to insert into, i.e. length of arrays pBindings and pData |
DBA_ReqId_t DBA_MultiReadRow | ( | const DBA_Binding_t *const | pBindings[], |
void *const | pData[], | ||
int | NbBindings, | ||
DBA_AsyncCallbackFn_t | CbFunc | ||
) |
Read one row for each specified binding (as one transaction).
pBindings | Array of pointers to bindings. |
pData | Array of pointers to structures. |
NbBindings | No of bindings (tables) to insert into i.e. length of arrays pBindings and pData |
DBA_ReqId_t DBA_MultiUpdateRow | ( | const DBA_Binding_t *const | pBindings[], |
const void *const | pData[], | ||
int | NbBindings, | ||
DBA_AsyncCallbackFn_t | CbFunc | ||
) |
Update one row for each specified binding (as one transaction).
pBindings | Array of pointers to bindings. |
pData | Array of pointers to structures. |
NbBindings | No of bindings (tables) to insert into i.e. length of arrays pBindings and pData |
DBA_ReqId_t DBA_MultiWriteRow | ( | const DBA_Binding_t *const | pBindings[], |
const void *const | pData[], | ||
int | NbBindings, | ||
DBA_AsyncCallbackFn_t | CbFunc | ||
) |
Update/insert one row for each specified binding (as one transaction).
pBindings | Array of pointers to bindings. |
pData | Array of pointers to structures. |
NbBindings | No of bindings (tables) to insert into i.e. length of arrays pBindings and pData |
DBA_Error_t DBA_Open | ( | ) |
Initialize DBA library and connect to NDB Cluster.
DBA_ReqId_t DBA_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)
pBinding | Binding between table columns and struct fields. |
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. |
NbRows | No of rows to read (i.e. length of pData array) |
DBA_Error_t DBA_SetParameter | ( | int | ParameterId, |
int | Value | ||
) |
Set DBA configuration parameter
Id Description Default Min Max == =========================== ======= ==== ==== 0 NBP Interval 10 4 - 1 Operations/Bulkread 1000 1 5000 2 Start transaction timeout 0 0 - 3 Force send algorithm 1 0 2 *
Boolean_t DBA_TableExists | ( | const char * | TableName | ) |
Test for existence of a table.
TableName | Table name. |
DBA_ReqId_t DBA_UpdateRows | ( | const DBA_Binding_t * | pBinding, |
const void *const | pData[], | ||
int | NbRows, | ||
DBA_AsyncCallbackFn_t | CbFunc | ||
) |
Update row(s) in the table (one transaction)
pBinding | Binding between table columns and struct fields. |
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. |
NbRows | No of rows to update (i.e. length of pData array). |
DBA_ReqId_t DBA_WriteRows | ( | const DBA_Binding_t * | pBinding, |
const void *const | pData[], | ||
int | NbRows, | ||
DBA_AsyncCallbackFn_t | CbFunc | ||
) |
Updates/Inserts row(s) in the table (one transaction)
pBinding | Binding between table columns and struct fields. |
pData | Array of pointers to structures. |
NbRows | No of rows to update/insert (i.e. length of pData array) |