-
char * name
The name of the field, as a null-terminated string. If the
field was given an alias with an AS
clause, the value of name
is the alias.
-
char * org_name
The name of the field, as a null-terminated string. Aliases
are ignored.
-
char * table
The name of the table containing this field, if it isn't a
calculated field. For calculated fields, the
table
value is an empty string. If the
table was given an alias with an AS
clause, the value of table
is the alias.
-
char * org_table
The name of the table, as a null-terminated string. Aliases
are ignored.
-
char * db
The name of the database that the field comes from, as a
null-terminated string. If the field is a calculated field,
db
is an empty string.
-
char * catalog
The catalog name. This value is always
"def"
.
-
char * def
The default value of this field, as a null-terminated
string. This is set only if you use
mysql_list_fields()
.
-
unsigned long length
The width of the field, as specified in the table
definition.
-
unsigned long max_length
The maximum width of the field for the result set (the
length of the longest field value for the rows actually in
the result set). If you use
mysql_store_result()
or
mysql_list_fields()
, this contains the
maximum length for the field. If you use
mysql_use_result()
, the value of this
variable is zero.
-
unsigned int name_length
The length of name
.
-
unsigned int org_name_length
The length of org_name
.
-
unsigned int table_length
The length of table
.
-
unsigned int org_table_length
The length of org_table
.
-
unsigned int db_length
The length of db
.
-
unsigned int catalog_length
The length of catalog
.
-
unsigned int def_length
The length of def
.
-
unsigned int flags
Different bit-flags for the field. The
flags
value may have zero or more of the
following bits set:
Use of the BLOB_FLAG
,
ENUM_FLAG
, SET_FLAG
,
and TIMESTAMP_FLAG
flags is deprecated
because they indicate the type of a field rather than an
attribute of its type. It is preferable to test
field->type
against
MYSQL_TYPE_BLOB
,
MYSQL_TYPE_ENUM
,
MYSQL_TYPE_SET
, or
MYSQL_TYPE_TIMESTAMP
instead.
The following example illustrates a typical use of the
flags
value:
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 the flags
value:
-
unsigned int decimals
The number of decimals for numeric fields.
-
unsigned int charset_nr
The character set number for the field.
-
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.
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");