HTML5 SQLTransaction
The SQLTransaction object is the object used to actually run SQL commands on your database.
Supported Platform(s)
- BlackBerry OS 5.0+
- BlackBerry PlayBook
- Ripple Emulator
API | OS 5.0 | OS 6.0 | OS 7.0 | PlayBook | Ripple |
---|---|---|---|---|---|
executeSql | Y | Y | Y | Y | Y |
Configuration Document Settings
To use all of the API described for this object, you must ensure the following settings are in your configuration document:
This API does not require a <feature> element to be declared in the configuration document of your BlackBerry WebWorks Application.Permission Elements (PlayBook Only) |
---|
This API does not require a <permission> element to be declared in the configuration document of your BlackBerry WebWorks Application. |
executeSql
void executeSql(sqlStatement : String, [arguments: Object[]], [callback: function], [errorCallback: function]) |
Supported Platform(s)
- BlackBerry OS 5.0+- BlackBerry PlayBook
- Ripple Emulator
Description
This method executes the provided SQL statement.
Parameter | Type | Description |
---|---|---|
sqlStatement | String | The SQL statement to be executed on the database. |
arguments |
Object[]
Optional |
The optional arguments used to preprocess a SQL statement by binding each ? placeholder with the value of the argument in the arguments array with the same position. |
callback |
function(transaction : SQLTransaction, resultSet : SQLResultSet)
Optional |
Function to be called when statement's result set is ready.
transaction: The SQLTransaction object that executed this transaction. resultSet: TheSQLResultSet object that contains the results of the SQL statement. |
errorCallback |
function(transaction : SQLTransaction, error : SQLError)
Optional |
Function to be called when an SQL error occurs.
transaction: The SQLTransaction object that executed this transaction. error: The SQLError object describing the SQL error that occurred. |
Code Example(s)
function showDocCount(db, span) { db.readTransaction( function (t) { t.executeSql('SELECT COUNT(*) AS c FROM docids', [], function (t, r) { span.textContent = r.rows[0].c; }, function (t, e) { // couldn't read database span.textContent = '(unknown: ' + e.message + ')'; } ); } ); }
Documentation generated by JsDoc Toolkit 2.4.0 on Sun Dec 30 2012 13:31:20 GMT-0500 (EST)