# Module: sql

Source:
  - services/sql.js, line 3

### 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:
  - services/sql.js, line 377

#### (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:
  - services/sql.js, line 368

##### 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:
  - services/sql.js, line 358

##### 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:
  - services/sql.js, line 334

##### 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:
  - services/sql.js, line 345

##### 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:
  - services/sql.js, line 324

##### Returns:

[object] - single value