C API Function Overview
2139
•
enum enum_field_types type
The type of the field. The
type
value may be one of the
MYSQL_TYPE_
symbols shown in the
following table.
Type Value
Type Description
MYSQL_TYPE_TINY
TINYINT
field
MYSQL_TYPE_SHORT
SMALLINT
field
MYSQL_TYPE_LONG
INTEGER
field
MYSQL_TYPE_INT24
MEDIUMINT
field
MYSQL_TYPE_LONGLONG
BIGINT
field
MYSQL_TYPE_DECIMAL
DECIMAL
or
NUMERIC
field
MYSQL_TYPE_NEWDECIMAL
Precision math
DECIMAL
or
NUMERIC
field (MySQL 5.0.3 and
up)
MYSQL_TYPE_FLOAT
FLOAT
field
MYSQL_TYPE_DOUBLE
DOUBLE
or
REAL
field
MYSQL_TYPE_BIT
BIT
field (MySQL 5.0.3 and up)
MYSQL_TYPE_TIMESTAMP
TIMESTAMP
field
MYSQL_TYPE_DATE
DATE
field
MYSQL_TYPE_TIME
TIME
field
MYSQL_TYPE_DATETIME
DATETIME
field
MYSQL_TYPE_YEAR
YEAR
field
MYSQL_TYPE_STRING
CHAR
or
BINARY
field
MYSQL_TYPE_VAR_STRING
VARCHAR
or
VARBINARY
field
MYSQL_TYPE_BLOB
BLOB
or
TEXT
field (use
max_length
to determine the
maximum length)
MYSQL_TYPE_SET
SET
field
MYSQL_TYPE_ENUM
ENUM
field
MYSQL_TYPE_GEOMETRY
Spatial field
MYSQL_TYPE_NULL
NULL
-type field
You can use the
IS_NUM()
macro to test whether a field has a numeric type. Pass the
type
value
to
IS_NUM()
and it evaluates to TRUE if the field is numeric:
if (IS_NUM(field->type))
printf("Field is numeric\n");
ENUM
and
SET
values are returned as strings. For these, check that the
type
value is
MYSQL_TYPE_STRING
and that the
ENUM_FLAG
or
SET_FLAG
flag is set in the
flags
value.
20.6.5. C API Function Overview
The functions available in the C API are summarized here and described in greater detail in a later
section. See
Section 20.6.6, “C API Function Descriptions”
.
Table 20.31. C API Function Names and Descriptions
Function
Description
my_init()
Initialize global variables, and thread handler in thread-safe
programs
Summary of Contents for 5.0
Page 1: ...MySQL 5 0 Reference Manual ...
Page 18: ...xviii ...
Page 60: ...40 ...
Page 396: ...376 ...
Page 578: ...558 ...
Page 636: ...616 ...
Page 844: ...824 ...
Page 1234: ...1214 ...
Page 1427: ...MySQL Proxy Scripting 1407 ...
Page 1734: ...1714 ...
Page 1752: ...1732 ...
Page 1783: ...Configuring Connector ODBC 1763 ...
Page 1793: ...Connector ODBC Examples 1773 ...
Page 1839: ...Connector Net Installation 1819 2 You must choose the type of installation to perform ...
Page 2850: ...2830 ...
Page 2854: ...2834 ...
Page 2928: ...2908 ...
Page 3000: ...2980 ...
Page 3122: ...3102 ...
Page 3126: ...3106 ...
Page 3174: ...3154 ...
Page 3232: ...3212 ...