Pike v8.1 release 6

Method Mysql.SqlTable()->select1()


Method select1

array select1(string|array select_expr, string|array where, void|string table_refs, void|string|array rest, void|string select_flags)

Description

Convenience variant of select for retrieving only a single column. The return value is an array containing the values in the select_expr column.

Parameter select_expr

The field to retrieve. It may name a column or a property, or it may be a select expression like "SHA1(x)". It may be given as an array to use bindings or sprintf-style formatting - see handle_argspec for details.

Parameter where

The match condition, on the form of a WHERE expression. A WHERE clause will always be generated, but you can put e.g. "TRUE" in the match condition to select all records.

where may be given as an array to use bindings or sprintf-style formatting - see handle_argspec for details.

Parameter table_refs

Optional other tables to join into the SELECT. This is inserted between "FROM table" and "WHERE".

Parameter rest

Optional clauses that follows after the WHERE clause, e.g. ORDER BY, GROUP BY, and LIMIT. It may be given as an array to use bindings or sprintf-style formatting - see handle_argspec for details.

Parameter select_flags

Flags for the SELECT statement. If this string is given, it is simply inserted directly after the "SELECT" keyword.

Returns

Returns an array with the values in the selected column. If a property is retrieved and some rows don't have the wanted property then UNDEFINED is put into those elements.

See also

select, get, get_multi