|  |  
 
MYSQL
 
This structure represents a handle to one database connection. It is
used for almost all MySQL functions.
MYSQL_RES
This structure represents the result of a query that returns rows
(SELECT,SHOW,DESCRIBE,EXPLAIN).  The
information returned from a query is called the result set in the
remainder of this section.MYSQL_ROW
This is a type-safe representation of one row of data. It is currently
implemented as an array of counted byte strings.  (You cannot treat these as
null-terminated strings if field values may contain binary data, because such
values may contain null bytes internally.)  Rows are obtained by calling
mysql_fetch_row().MYSQL_FIELD
This structure contains information about a field, such as the field's
name, type and size. Its members are described in more detail below.
You may obtain the MYSQL_FIELDstructures for each field by
callingmysql_fetch_field()repeatedly.  Field values are not part of
this structure; they are contained in aMYSQL_ROWstructure.MYSQL_FIELD_OFFSET
This is a type-safe representation of an offset into a MySQL field
list.  (Used by mysql_field_seek().)  Offsets are field numbers
within a row, beginning at zero.my_ulonglong
The type used for the number of rows and for mysql_affected_rows(),mysql_num_rows()andmysql_insert_id(). This type provides a
range of0to1.84e19.
On some systems, attempting to print a value of typemy_ulonglongwill not work.  To print such a value, convert it tounsigned longand use a%luprint format.  Example:
printf (Number of rows: %lu\n", (unsigned long) mysql_num_rows(result));
 
The MYSQL_FIELDstructure contains the members listed below: 
char * name
The name of the field.
char * table
The name of the table containing this field, if it isn't a calculated field.
For calculated fields, the tablevalue is aNULLpointer.char * def
The default value of this field (set only if you use
mysql_list_fields()).enum enum_field_types type
The type of the field.
The typevalue may be one of the following:
You can use the| Type value | Type meaning |  | FIELD_TYPE_TINY | TINYINTfield |  | FIELD_TYPE_SHORT | SMALLINTfield |  | FIELD_TYPE_LONG | INTEGERfield |  | FIELD_TYPE_INT24 | MEDIUMINTfield |  | FIELD_TYPE_LONGLONG | BIGINTfield |  | FIELD_TYPE_DECIMAL | DECIMALorNUMERICfield |  | FIELD_TYPE_FLOAT | FLOATfield |  | FIELD_TYPE_DOUBLE | DOUBLEorREALfield |  | FIELD_TYPE_TIMESTAMP | TIMESTAMPfield |  | FIELD_TYPE_DATE | DATEfield |  | FIELD_TYPE_TIME | TIMEfield |  | FIELD_TYPE_DATETIME | DATETIMEfield |  | FIELD_TYPE_YEAR | YEARfield |  | FIELD_TYPE_STRING | String ( CHARorVARCHAR) field |  | FIELD_TYPE_BLOB | BLOBorTEXTfield (usemax_lengthto determine the maximum length) |  | FIELD_TYPE_SET | SETfield |  | FIELD_TYPE_ENUM | ENUMfield |  | FIELD_TYPE_NULL | NULL-type field |  | FIELD_TYPE_CHAR | Deprecated; use FIELD_TYPE_TINYinstead |  IS_NUM()macro to test whether or not a field has a
numeric type.  Pass thetypevalue toIS_NUM()and it
will evaluate to TRUE if the field is numeric:
if (IS_NUM(field->type))
    printf("Field is numeric\n");
unsigned int length
The width of the field.
unsigned int max_length
The maximum width of the field for the result set. If you used
mysql_list_fields(), this contains the maximum length for the field.unsigned int flags
Different bit-flags for the field.  The flagsvalue may have zero
or more of the following bits set:
Use of the| Flag value | Flag meaning |  | NOT_NULL_FLAG | Field can't be NULL |  | PRI_KEY_FLAG | Field is part of a primary key |  | UNIQUE_KEY_FLAG | Field is part of a unique key |  | MULTIPLE_KEY_FLAG | Field is part of a non-unique key. |  | UNSIGNED_FLAG | Field has the UNSIGNEDattribute |  | ZEROFILL_FLAG | Field has the ZEROFILLattribute |  | BINARY_FLAG | Field has the BINARYattribute |  | AUTO_INCREMENT_FLAG | Field has the AUTO_INCREMENTattribute |  | ENUM_FLAG | Field is an ENUM(deprecated) |  | BLOB_FLAG | Field is a BLOBorTEXT(deprecated) |  | TIMESTAMP_FLAG | Field is a TIMESTAMP(deprecated) |  BLOB_FLAG,ENUM_FLAGandTIMESTAMP_FLAGflags
is deprecated because they indicate the type of a field rather than an
attribute of its type.  It is preferable to testfield->typeagainstFIELD_TYPE_BLOB,FIELD_TYPE_ENUMorFIELD_TYPE_TIMESTAMPinstead.
The example below illustrates a typical use of theflagsvalue:
if (field->flags & NOT_NULL_FLAG)
    printf("Field can't be null\n");
You may use the following convenience macros to determine the boolean
status of theflagsvalue:
| IS_NOT_NULL(flags) | True if this field is defined as NOT NULL |  | IS_PRI_KEY(flags) | True if this field is a primary key |  | IS_BLOB(flags) | True if this field is a BLOBorTEXT(deprecated; testfield->typeinstead) | unsigned int decimals
The number of decimals for numeric fields.
 |