This page describes the public data structures used by MariaDB Connector/C.

MYSQL

The MYSQL structure represents one database connection and is used by most of MariaDB Connector/C's API functions. The MYSQL structure needs to be allocated and initialized by the mysql_init() API function. It will be released by the mysql_close() function.

The MYSQL structure should be considered as opaque; copying or changing values of its members might produce unexpected results, errors or program crashes.

MYSQL_RES

The MYSQL_RES structure represents a result set which contains data and metadata information. It will be returned by the mysql_use_result(), mysql_store_result() and mysql_stmt_result_metadata() API functions and needs to be released by mysql_free_result().

The MYSQL_RES structure should be considered as opaque; copying or changing values of its members might produce unexpected results, errors or program crashes.

MYSQL_ROW

MYSQL_ROW represents an array of character pointers, pointing to the columns of the actual data row. Data will be received by the mysql_fetch_row() function. The size of the array is the number of columns for the current row.

After freeing the result set with mysql_free_result() MYSQL_ROW becomes invalid.

MYSQL_STMT

The MYSQL_STMT structure represents a prepared statement handle and is used by MariaDB Connector/C's prepared statement API functions. The MYSQL_STMT structure needs to be allocated and initialized by the mysql_stmt_init() function and needs to be released by the mysql_stmt_close() function.

The MYSQL_STMT structure should be considered as opaque; copying or changing values of its members might produce unexpected results, errors or program crashes.

MYSQL_FIELD

The MYSQL_FIELD structure describes the metadata of a column. It can be obtained by the mysql_fetch_field() function.

It has the following members:

char *nameThe name of the column
unsigned intname_lengthThe length of column name
char *org_name The original name of the column
unsigned intorg_name_lengthThe length of original column name
char *tableThe name of the table
unsigned inttable_lengthThe length of table name
char *org_table The original name of the table
unsigned intorg_table_lengthThe length of original table name
char *db The name of the database (schema)
unsigned intdb_lengthThe length of database name
char *catalogThe catalog name (always 'def')
unsigned intcatalog_lengthThe length of catalog name
char *defdefault value
unsigned intdef_lengthThe length of default value
unsigned intlengthThe length (width) of the column definition
unsigned intmax_lengthThe maximum length of the column value
unsigned intflagsFlags
unsigned intdecinalsNumber of decimals
enum enum_field_typestypeField type

MYSQL_BIND

The MYSQL_BIND structure is used to provide parameters for prepared statements or to receive output column value from prepared statements.

unsigned long *lengthPointer for the length of the buffer (not used for parameters)
my_bool *is_nulllPointer which indicates if column is NULL (not used for parameters)
my_bool *errorPointer which indicates if an error occured
void *bufferData buffer which contains or receives data
char *u.indicatorArray of indicator variables for bulk operation parameter
unsigned longbuffer_lengthLength of buffer
enum enum_field_typesbuffer_typeBuffer type
unsigned longlength_valueUsed if length pointer is NULL
my_boolerror_valueUsed if error pointer is NULL
my_boolis_null_valueUsed if is_null pointer is NULL
my_boolis_unsignedSet if integer type is unsigned
my_boolis_null_valueUsed if value is NULL

MYSQL_TIME

The MYSQL_TIME structure is used for date and time values in prepared statements. It has the following members:

unsigned intyearYear
unsigned intmonthMonth
unsigned intdayDay
unsigned inthourHour
unsigned intminuteMinute
unsigned intsecondSecond
unsigned longsecond_partFractional seconds (max. 6 digits)
my_boolnegNegative value
enum enum_mysql_timestamp_typetime_typeType

Comments

Comments loading...