Method Mysql.mysql()->list_fields()
- Method list_fields
array
(int
|mapping
(string
:mixed
)) list_fields(string
table
)
array
(int
|mapping
(string
:mixed
)) list_fields(string
table
,string
wild
)- Description
List all fields.
Returns an array of mappings with information about the fields in the table named
table
. If the argumentwild
is given, only those fields matching it will be returnedThe mappings contain the following entries:
"name"
:string
The name of the field.
"table"
:string
The name of the table.
"default"
:string
The default value for the field.
"type"
:string
The SQL type of the field.
"length"
:int
The length of the longest possible value that can be stored in the field. Note that this measures the display length in string form.
"flags"
:multiset
(string
)Some flags.
decimals
:int
The number of decimalplaces.
The type of the field can be any of:
"decimal"
,"char"
,"short"
,"long"
,"float"
,"double"
,"null"
,"time"
,"longlong"
,"int24"
,"tiny blob"
,"medium blob"
,"long blob"
,"var string"
,"string"
or"unknown"
.The flags multiset can contain any of:
"primary_key"
This field is part of the primary key for this table.
"unique"
This field is part of a unique key for this table.
"multiple_key"
This field is part of a nonunique key for this table.
"not_null"
This field cannot be NULL.
"blob"
This field is a BLOB or TEXT.
"auto_increment"
This field has the AUTO_INCREMENT attribute.
"zerofill"
This Field has the ZEROFILL attribute.
"binary"
This Field has the BINARY attribute.
"enum"
This Field is an ENUM.
"set"
This Field is a SET.
"unsigned"
This Field has the UNSIGNED attribute.
"numeric"
This Field is numeric.
- Note
Michael Widenius recomends use of the following query instead: show fields in 'table' like "wild".
- See also
list_dbs(), list_tables(), list_processes(), Mysql.mysql()->Result()->fetch_field()