Package | flash.data |
Class | public class SQLResult |
Inheritance | SQLResult ![]() |
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 instance 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 whether there are
additional SELECT
result rows that haven't been retrieved (using the
complete
property).
See also
Property | Defined By | ||
---|---|---|---|
![]() [read-only]
Indicates whether all the resulting data from a statement execution has been returned. | SQLResult | ||
![]() | constructor : Object
A reference to the class object or constructor function for a given object instance. | Object | |
![]() [read-only]
The data returned as a result of the statement execution, specifically when
a SQL SELECT statement is executed. | SQLResult | ||
![]() [read-only]
The last generated row identifier generated by a SQL INSERT
statement. | SQLResult | ||
![]() | prototype : Object [static]
A reference to the prototype object of a class or function object. | Object | |
![]() [read-only]
Indicates how many rows were affected by the operation. | SQLResult |
Method | Defined By | ||
---|---|---|---|
Creates a SQLResult instance. | SQLResult | ||
![]() |
Indicates whether an object has a specified property defined. | Object | |
![]() |
Indicates whether an instance of the Object class is in the prototype chain of the object specified
as the parameter. | Object | |
![]() |
Indicates whether the specified property exists and is enumerable. | Object | |
![]() |
Sets the availability of a dynamic property for loop operations. | Object | |
![]() |
Returns the string representation of this object, formatted according to locale-specific conventions. | Object | |
![]() |
Returns the string representation of the specified object. | Object | |
![]() |
Returns the primitive value of the specified object. | Object |
![]() | property |
complete:Boolean
[read-only] Indicates whether all the resulting data from a statement execution has been returned.
When a statement returns one or more rows this property indicates
whether 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's 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
.
public function get complete():Boolean
See also
![]() | property |
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
.
public function get data():Array
![]() | property |
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."
public function get lastInsertRowID():Number
See also
![]() | property |
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 (that is, 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 are deleted, and the rowsAffected
property accurately
reflects 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.
public function get rowsAffected():Number
See also
![]() | () | Constructor |
public 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 instance 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 instance is specified for an execute()
or next()
method call.
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 the executed statement affected.
| |
complete:Boolean (default = true ) — Indicates whether there are additional rows that can
be fetched or whether all data has been returned.
| |
rowID:Number (default = 0 ) — If the statement was a SQL INSERT operation this is the new
unique identifier for the row.
|