Module query/query

Provides query functionality for both SqlStore type of queries and raw SQL ones.

Functions


getNamedParameter (nparams, name)

Helper function for retrieving the parameter description with the given name

Parameters

Object nparams The object containing the named parameters
String name The name of the parameter for which to retrieve the description for

Returns

Object The parameter description

See


getParameterDescription (value)

Returns the parameter description for the given value

Parameters

Object value The value to retrieve the parameter description for

Returns

Object An object containing the properties "type" and "value". The former is the type of value ("string", "boolean", "long", "double", "timestamp" or null for null values), the latter the value passed as argument.

getSelector (store, queryStr)

Returns a selector object (containing the query AST and the SQL query generator function) for a query. This method does a query cache lookup first, and if it's a miss parses the query string into an AST and creates the SQL query generator function.

Parameters

Store store The store to operate on
String queryStr The query string

query (store, queryStr, nparams)

Returns the result of a query. This method must not be called directly, use Store.prototype.query() instead.

Parameters

Store store The store to operate on
String queryStr The query string
Object nparams Optional object containing named parameters referenced in the query

Returns

Array The query result

See


sqlQuery (store, queryStr, params)

Returns the result of a raw SQL query. This method must not be called directly, use Store.prototype.sqlQuery() instead.

Parameters

Store store The store to operate on
String queryStr The query string
Array params Optional array containing parameters referenced in the query

Returns

Array The query result

See