Method Mysql.SqlTable()->get()


Method get

mapping(string:mixed)|zero get(mixed id, void|array(string) fields)

Description

Returns the record matched by a primary key value, or zero if there is no such record.

Parameter id

The value for the primary key.

If the table has a multicolumn primary key then id must be an array which has the values for the primary key columns in the same order as pk_cols. Otherwise id is taken directly as the value of the single primary key column.

Parameter fields

The fields to retrieve. All fields are retrieved if it's zero or left out.

For columns, the result mappings always have corresponding entries. Other fields, i.e. properties, only occur in the result mappings when they match fields in the prop_col column.

A 0 (zero) entry can be used in fields to return all properties without filtering.

See also

select, select1, get_multi