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 1.0+
- BlackBerry 10
- Ripple Emulator
View Supported Platform Table
APIBB5.0BB6.0BB7.0PB1.0PB2.0BB10Ripple
executeSql Y Y Y Y Y YY

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 and BlackBerry 10+)
This API does not require a <permission> element to be declared in the configuration document of your BlackBerry WebWorks Application.

Functions

void executeSql

Functions

void executeSql (sqlStatement : String, [arguments : Object[]], [callback: function(transaction : SQLTransaction, resultSet : SQLResultSet)], [errorCallback: function(transaction : SQLTransaction, error : SQLError)])


This method executes the provided SQL statement.


Supported Platforms
 - BlackBerry OS 5.0+
 - BlackBerry PlayBook 1.0+
 - BlackBerry 10
 - Ripple Emulator


Parameters
sqlStatement The SQL statement to be executed on the database.
arguments 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 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 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:
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 18:15:44 GMT-0500 (EST)