C API Data Structures
2136
A boolean type, for values that are true (nonzero) or false (zero).
The
MYSQL_FIELD
structure contains the members described in the following list:
•
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. For expressions, the value is
an empty string.
•
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 column is selected from a view,
table
names the view. If the
table or view was given an alias with an
AS
clause, the value of
table
is the alias. For a
UNION
, the
value is the empty string.
•
char * org_table
The name of the table, as a null-terminated string. Aliases are ignored. If the column is selected from
a view,
org_table
names the underlying table. For a
UNION
, the value is the empty string.
•
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. For a
UNION
, the value is the 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. This corresponds to the display length, in bytes.
The server determines the
length
value before it generates the result set, so this is the minimum
length required for a data type capable of holding the largest possible value from the result column,
without knowing in advance the actual values that will be produced by the query for the result set.
•
unsigned long max_length
The maximum width of the field for the result set (the length in bytes 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.
The value of
max_length
is the length of the string representation of the values in the result set. For
example, if you retrieve a
FLOAT
column and the “widest” value is
-12.345
,
max_length
is 7 (the
length of
'-12.345'
).
If you are using prepared statements,
max_length
is not set by default because for the binary
protocol the lengths of the values depend on the types of the values in the result set. (See
Section 20.6.8, “C API Prepared Statement Data Structures”
.) If you want the
max_length
values
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 ...