executeQuerySQL
Executes an SQL query in the local database and makes the queried fields available in the parameters of the onSuccess action.
Field Configurations
Key | Type | Description | Default Value |
---|---|---|---|
"params" (required) | Object | undefined | null |
Parameters
Key | Type | Description | Default Value |
---|---|---|---|
"async" | Boolean | Specifies whether the action should perform asynchronously. | null |
"onError" | String | Event that is fired of case of an error. | null |
"onErrorType" | OnErrorType | Type of event that will be fired on error. | null |
"onSuccess" | String | Event that is fired in case of success. | null |
"onSuccessType" | OnSuccessType | Type of event that will be fired on success. | null |
"sql" (required) | String | The SQL query that is to be executed. | null |
"sqlParams" | Array | The parameters for the SQL query. | null |
Inherited
From Base Action
Base Action
Field Configurations
Key | Type | Description | Default Value |
---|---|---|---|
"dynamicParams" | Object | Dynamic params to retrieve data from a specific context e.g. a userSetting. | null |
"leadingDelimiter" | String | The leading mustache delimiter to use. | null |
"params" | Object,Array | Object containing the properties of the action. | null |
"trailingDelimiter" | String | The trailing mustache delimiter to use. | null |
"type" | String | Type name of the action. | null |
Examples
Example 1: Execute an SQL query
Goal: Create an executeQuerySQL action using the resulting fields in the onSuccess event.
To achieve this the following code can be used:
{
"type": "executeQuerySQL",
"params": {
"sql": "SELECT name FROM vehicles WHERE type = ?1",
"sqlParams": [
"car"
],
"onSuccess": "successEvent",
"onError": "errorEvent"
}
}
The sql
and sqlParams
parameters specify queried fields.
Within the onSuccess event, the resulting fields can be accessed as follows (depending on the OS of the device, both results.0
and results.first
may both be required):
{
"type": "successEvent",
"actions": [
{
"type": "showMessage",
"params": {
"text": "{{results.0.name}}{{results.first.name}}"
}
}
]
}
Result:
An executeQuerySQL action has been created.