Extracted from Pike v7.3 release 16 at 2002-03-05.
pike.roxen.com
[Top]
Mysql
Mysql.mysql

Method Mysql.mysql()->list_fields()


Method list_fields

array(int|mapping(string:mixed)) Mysql.mysql()->list_fields(string table)
array(int|mapping(string:mixed)) Mysql.mysql()->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 field.

"max_length" : int

The length of the longest element in this field.

"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

Mysql.mysql.list_dbs, Mysql.mysql.list_tables, Mysql.mysql.list_processes, Mysql.mysql_result.fetch_field