Pike v8.1 release 6

Method Mysql.SqlTable()->handle_argspec()


Method handle_argspec

local string handle_argspec(array argspec, mapping(string:mixed) bindings)

Description

Helper function for use with array style arguments.

Many functions in this class can take WHERE expressions etc either as plain strings or as arrays. In array form, they work like when Sql.Sql.query is called with more than one argument:

The first element in the array is a string containing the SQL snippet. If the second element is a mapping, it's taken as a bindings mapping, otherwise the remaining elements are formatted using the first in sprintf fashion. See Sql.Sql.query for further details.

This function reduces an argument on array form to a simple string, combined with bindings. bindings is a mapping that is modified to contain the new bindings.

Note

The quote function can be used to quote string literals in the query, to avoid the array format.

Returns

Return the SQL snippet in string form, possibly with variable bindings referring to bindings.