Pike v8.0 release 1738

Method Msql.msql()->list_fields()


Method list_fields

mapping(string:mapping(string:mixed)) list_fields(string table, void|string glob)

Description

Returns a mapping describing the fields of a table in the database. The returned value is a mapping, indexed on the column name, of mappings.The glob argument, if present, filters out the fields not matching the glob. These contain currently the fields:

"type" : string

Describes the field's mSQL data type ("char","integer",...)

"length" : int

It describes the field's length. It is only interesting for char() fields, in fact. Also notice that the strings returned by msql->query() have the correct length. This field only specifies the _maximum_ length a "char()" field can have.

"table" : string

The table this field is in. Added only for interface compliancy.

"flags" : multiset(string)

It's a multiset containing textual descriptions of the server's flags associated with the current field. Currently it can be empty, or contain "unique" or "not null".

Note

The version of this function in the Msql.msql() program is not sql-interface compliant (this is the main reason why using that program directly is deprecated). Use Sql.Sql instead.

See also

query