This method provides access (with single record granularity) to data saved in the Client
Store.
runQuery( query, parameters, targetTableName, onSuccess, onFailure )
This method does not return anything.
Name |
Description |
Type |
Use |
query |
An SQL query that relies on the SQLite
syntax. NoteThe following restrictions apply only when the targetTableName
parameter is passed:
|
string |
required |
parameters |
An array of parameters, in the order of their appearance in the query. The types
and formatting of the parameters must match the following rules:
text values must be given as strings numerical values must be given as numbers boolean values must be given as numbers, where 0 indicates "false" and 1
indicates "true" datetime, as well as date and time values must be given as strings in
"YYYY-MM-DDTHH:MM:SS.SSS" format defined in "Time Strings" section in the SQLLite
documentation, which is equivalent to "yyyy-MM-dd'T'HH:mm:ss.SSS"
pattern defined in Java Platform SE 7 documentation. For values of the "date" type, hours, minutes, seconds and milliseconds must
be set to 0. For values of the "time" type, the date section must be set to
"1970-01-01".
The length of the array must match the number of the questionmark character
occurrences in the query. If no parameters are used, an empty array must be
passed. |
object |
required |
targetTableName |
A name of the target datapage. Used to obtain column types when formatting the result.
If null or undefined, a raw SQL result is returned. |
string |
optional |
onSuccess |
A callback function, called when the query succeeds. It passes a
results object, being an array of selected rows. Each row is
a column name/column value map. Unless the targetTableName
parameter is null or undefined, values are formatted as follows:
text values are given as strings numbers are written in decimal notation with a dot used as the decimal
separator boolean values are represented as either "true" or "false" datetime values are represented using the pattern defined in Java Platform SE 7 documentation: "yyyyMMdd'T'HHmmss.SSS z", e.g.
"20151027T162344.455 GMT" date values are represented using the "yyyyMMdd" pattern, e.g
"20151027" time values are represented using the "HHmmss" pattern, e.g. "162344"
The order of returned rows is maintained only if the query includes the "ORDER BY"
clause.
|
function |
required |
onFailure |
A callback function, called when the operation fails. Passes an error code, as defined
in the Constants table in the Client Store article, and an error message. |
function |
required |