window.runtime propertywindow.runtime.flash.data.SQLResult
InheritanceSQLResult Inheritance Object

The SQLResult class provides access to data returned in response to the execution of a SQL statement (a SQLStatement instance).

The SQLResult instance for a SQL statement is accessed by calling the SQLStatement.getResult() method or as an argument passed to the result handler of a Responder specified in a call to SQLStatement.execute() or SQLStatement.next(). Generally, developer code does not construct SQLResult instances directly.

You use a SQLResult object to access the rows of data returned from a SELECT statement (using the data property), to get row identifier information for an INSERT statement (using the lastInsertRowID property), to determine the number of rows affected by an INSERT, UPDATE, or DELETE statement (using the rowsAffected property), or to determine if there are additional SELECT result rows that haven't been retrieved (using the complete property).

See also

SQLStatement.getResult()
SQLStatement.execute()
SQLStatement.next()


Properties
 PropertyDefined By
  complete : Boolean
[read-only] Indicates if all the resulting data from a statement execution has been returned.
SQLResult
 Inheritedconstructor : Object
A reference to the class object or constructor function for a given object instance.
Object
  data : Array
[read-only] The data returned as a result of the statement execution, specifically when a SQL SELECT statement is executed.
SQLResult
  lastInsertRowID : Number
[read-only] The last generated row identifier generated by a SQL INSERT statement.
SQLResult
 Inheritedprototype : Object
[static] A reference to the prototype object of a class or function object.
Object
  rowsAffected : Number
[read-only] Indicates how many rows were affected by the operation.
SQLResult
Public Methods
 MethodDefined By
  
SQLResult(data:Array = null, rowsAffected:Number = 0, complete:Boolean = true, rowID:Number = 0)
Creates a SQLResult instance.
SQLResult
 Inherited
hasOwnProperty(name:String):Boolean
Indicates whether an object has a specified property defined.
Object
 Inherited
isPrototypeOf(theClass:Object):Boolean
Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter.
Object
 Inherited
propertyIsEnumerable(name:String):Boolean
Indicates whether the specified property exists and is enumerable.
Object
 Inherited
setPropertyIsEnumerable(name:String, isEnum:Boolean = true):void
Sets the availability of a dynamic property for loop operations.
Object
 Inherited
toString():String
Returns the string representation of the specified object.
Object
 Inherited
valueOf():Object
Returns the primitive value of the specified object.
Object
Property Detail
completeproperty
complete:Boolean  [read-only]

Indicates if all the resulting data from a statement execution has been returned.

When a statement returns one or more rows this property will indicate if all of the rows have been returned. When a SQLStatement object's execute() method is called with a prefetch argument value, only the specified number of rows of the resulting data are returned in the SQLResult object's data property. Subsequent calls to SQLStatement.next() cause additional data to become available. This property is used to determine when the final results have been returned.

Note that because the number of rows is unknown at execution time, the database cursor must move beyond the last row before a statement execution is considered complete. When the SQLStatement.execute() method is called with a prefetch argument, at least one row more than the total number of rows in the result set must be requested before the resulting SQLResult instance's complete property is true.


See also

dataproperty 
data:Array  [read-only]

The data returned as a result of the statement execution, specifically when a SQL SELECT statement is executed.

When a statement returns one or more rows this property is an array containing objects whose property names correspond to the result data set's column names. When a statement does not return any data this property is null.


lastInsertRowIDproperty 
lastInsertRowID:Number  [read-only]

The last generated row identifier generated by a SQL INSERT statement.

The value is 0 if the executed statement was not an INSERT statement.

A row identifier is used to uniquely identify a row in a table within the database. The value is frequently generated by the database.

For more information about primary keys and generated row identifiers, see the CREATE TABLE and Expressions sections in the appendix SQL support in local databases.


See also

rowsAffectedproperty 
rowsAffected:Number  [read-only]

Indicates how many rows were affected by the operation. Only changes that are directly specified by an INSERT, UPDATE, or DELETE statement are counted.

Auxiliary changes caused by triggers are not counted. Use the SQLConnection.totalChanges property to find the total number of changes including changes caused by triggers.

Note that when the related SQL operation is a DELETE statement with no WHERE clause (i.e. the statement deletes all the rows in the table), the rowsAffected property is always 0, regardless of the number of rows that were deleted. If you need to know the number of rows that are deleted, you can include the WHERE clause WHERE 1 = 1, in which case all the rows will be deleted and the rowsAffected property will accurately reflect the number of rows that were deleted. However, depending on the number of rows being deleted, doing so may have a negative impact on the statement's performance.


See also

Constructor Detail
SQLResult()Constructor
function SQLResult(data:Array = null, rowsAffected:Number = 0, complete:Boolean = true, rowID:Number = 0)

Creates a SQLResult instance. Generally, developer code does not call the SQLResult constructor directly. To retrieve a SQLResult associated with a particular SQLStatement instance, call the instance's getResult() method. A SQLResult instance is also passed as an argument to the result handler function when a Responder is specified for an execute() or next() method call.

Parameters
data:Array (default = null) — The array of rows returned from the execution of a statement. If the statement doesn't return any rows this value should be null.
 
rowsAffected:Number (default = 0) — Indicates how many rows were affected by the statement executed.
 
complete:Boolean (default = true) — Indicates if there are additional rows that can be fetched or if all data has been returned.
 
rowID:Number (default = 0) — If the statement was a SQL INSERT operation this will be the new unique identifier for the row.




 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/labs/air/1/jslr/flash/data/SQLResult.html