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

#### (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 346

##### 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 336

##### 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 312

##### 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 323

##### 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 302

##### Returns:

[object] - single value