Extracted from Pike v7.8 release 866 at 2016-11-06.
pike.ida.liu.se
[Top]
Mysql
Mysql.mysql

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 argument wild is given, only those fields matching it will be returned

The 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.

"not_null"

This field may not be NULL.

"blob"

This field is a blob field.


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()