Result (gb.db)

This class represents the result of a SQL request.

This class is not creatable.

This class acts like a read / write array.

This class is enumerable with the FOR EACH keyword.

Properties
Available   Returns True if the result object contains one or more accessible database rows.
Connection   Returns the parent connection object.
Count   Returns the number of rows in the query result.
Editable   Return if the result is editable.
Fields   Returns a collection of the fields of the result.
Index   Returns the index of the current record, starting from zero.
Length   This is a synonymous for the Count property.
Max   Returns Result.Count - 1 (as long as the count is >= 0, otherwise -1 is returned).

Methods
All   Return the value of the specified field of each result record as an array.
Delete   Deletes the current record.
MoveFirst   Moves to the first record of the result.
MoveLast   Moves to the last record of the result.
MoveNext   Moves to the next record of the result.
MovePrevious   Moves to the previous record of the result.
MoveTo   Moves to a specified record.
Update   Updates the current record into the database, if this record has been modified and the Result is a read/write cursor.

Result Cursors

The Result object is a cursor i.e. a view of a constrained set of rows arising from the execution of the query by the database engine. The cursor, depending on how it was executed may or may not "lock" rows and tables in the database. Such locking enables guaranteed updates to be made to data in the database by only one user at a time. (This is fundamental to rdbms theory.)

In the Gambas db world these cursors are described, naturally enough, as read only and read/write. Different result returning methods from the Connection class return different cursor types:

Method Result Type
Create Read/Write
Edit Read/Write
Exec Read Only
Find Read Only