Libraries anvil sql ResultSet

class ResultSet
extends anvil.sql.MetaData
Class reprsenting result of SQL query as a two dimensional table.

Constants

constant CONCUR_READ_ONLY
The concurrency mode for a ResultSet object that may NOT be updated.

constant CONCUR_UPDATABLE
The concurrency mode for a ResultSet object that may be updated.

constant FETCH_FORWARD
The rows in a result set will be processed in a forward direction; first-to-last.

constant FETCH_FORWARD_ONLY
The type for a ResultSet object whose cursor may move only forward.

constant FETCH_REVERSE
The rows in a result set will be processed in a reverse direction; last-to-first.

constant FETCH_SCROLL_INSENSITIVE
The type for a ResultSet object that is scrollable and generally not sensitive to changes made by others.

constant FETCH_SCROLL_SENSITIVE
The type for a ResultSet object that is scrollable and generally sensitive to changes made by others.

constant FETCH_UNKNOWN
The order in which rows in a result set will be processed is unknown.


Methods

boolean absolute(int row)
Moves cursor to given row number in result set.

If the row number is positive, the cursor moves to the given row number with respect to the beginning of the result set. The first row is row 1, the second is row 2, and so on.

If the given row number is negative, the cursor moves to an absolute row position with respect to the end of the result set. For example, calling absolute(-1) positions the cursor on the last row, absolute(-2) indicates the next-to-last row, and so on.

An attempt to position the cursor beyond the first/last row in the result set leaves the cursor before/after the first/last row, respectively.

Note: Calling absolute(1) is the same as calling first(). Calling absolute(-1) is the same as calling last().

Returns true if the cursor is on result set
Throws SQLError -  if an error occured

ResultSet afterLast()
Moves the cursor to end of result set, just after the last row.
Returns this
Throws SQLError -  if an error occured

ResultSet beforeFirst()
Moves the cursor to front of result set, just before the first row.
Returns this
Throws SQLError -  if an error occured

ResultSet close()
Closes this result set, releasing all the resources associated with it.
Throws SQLError -  if an error occured

boolean first()
Moves the cursor to first row.
Returns true if the cursor is on valid row
Throws SQLError -  if an error occured

object get()
Moves to next row and retrieves the first value from row. Note: this method closes the result set.
Returns Value of first column in next row
Throws SQLError -  if an error occured

int getConcurrency()
Returns the concurrency mode of this result set. The concurrency used is determined by the statement that created the result set.
Returns the concurrency type, CONCUR_READ_ONLY or CONCUR_UPDATABLE
Throws SQLError -  if an error occured

int getFetchDirection()
Returns the fetch direction for this result set.
Returns the current fetch direction
Throws SQLError -  if an error occured

array getList()
Gets next row as a list. Columns can be accessed with their indices. Method next() must be called before this function.
Returns next row as list
Throws SQLError -  if an error occured

array getRow()
Gets next row as an array. Columns can be accessed with their respective names. Method next() must be called before this function.
Returns next row as array
Throws SQLError -  if an error occured

array getRows()
array getRows(int max)
Gets next rows as an array of arrays. This method will calls first next().
Parameters max -  max number of rows
Returns array of arrays
Throws SQLError -  if an error occured

boolean last()
Moves the cursor to last row.
Returns true if the cursor is on valid row
Throws SQLError -  if an error occured

boolean next()
Moves the cursor to next row. Initially cursor is located at row before first.
Returns true if cursor was moved to next row
Throws SQLError -  if an error occured

boolean previous()
Moves the cursor to previous row.
Returns true if cursor was moved to next row
Throws SQLError -  if an error occured

boolean relative(int rows)
Moves the cursor a relative number of rows, either positive or negative. Attempting to move beyond the first/last row in the result set positions the cursor before/after the the first/last row. Calling relative(0) is valid, but does not change the cursor position.

Note: Calling relative(1) is different from calling next() because is makes sense to call next() when there is no current row, for example, when the cursor is positioned before the first row or after the last row of the result set.

Returns true if the cursor is on result set
Throws SQLError -  if an error occured

int row()
Returns the current row number.
Returns current row number
Throws SQLError -  if an error occured

ResultSet setFetchDirection(int dir)
Gives a hint as to the direction in which the rows in this result set will be processed. The initial value is determined by the statement that produced the result set. The fetch direction may be changed at any time.
Throws SQLError -  if an error occured


Attributes

"object ResultSet.columnName"
Returns the value of column with given name.
Parameters columnName -  Name of column


References

"object ResultSet[int columnIndex]"
Returns the value of column at given index.
"object ResultSet[string columnName]"
Returns the value of column with given name.
Parameters columnIndex -  Index of column, from 0 (inclusive) to getColumnCount()-1.
columnName -  Name of column