Module: sql

Methods

(static) execute(query, paramsopt)

Execute SQL
Parameters:
Name Type Attributes Description
query string SQL query with ? used as parameter placeholder
params Array.<object> <optional>
array of params if needed
Source:

(static) getColumn(query, paramsopt) → {Array.<object>}

Get a first column in an array.
Parameters:
Name Type Attributes Description
query string SQL query with ? used as parameter placeholder
params Array.<object> <optional>
array of params if needed
Source:
Returns:
- array of first column of all returned rows
Type
Array.<object>

(static) getMap(query, paramsopt) → {object}

Get a map of first column mapping to second column.
Parameters:
Name Type Attributes Description
query string SQL query with ? used as parameter placeholder
params Array.<object> <optional>
array of params if needed
Source:
Returns:
- map of first column to second column
Type
object

(static) getRow(query, paramsopt) → {object}

Get first returned row.
Parameters:
Name Type Attributes Description
query string SQL query with ? used as parameter placeholder
params Array.<object> <optional>
array of params if needed
Source:
Returns:
- map of column name to column value
Type
object

(static) getRows(query, paramsopt) → {Array.<object>}

Get all returned rows.
Parameters:
Name Type Attributes Description
query string SQL query with ? used as parameter placeholder
params Array.<object> <optional>
array of params if needed
Source:
Returns:
- array of all rows, each row is a map of column name to column value
Type
Array.<object>

(static) getValue(query, paramsopt)

Get single value from the given query - first column from first returned row.
Parameters:
Name Type Attributes Description
query string SQL query with ? used as parameter placeholder
params Array.<object> <optional>
array of params if needed
Source:
Returns:
[object] - single value