Overview Module Function Class Tea 3.2.4 Reference Documentation
© 2009 PDM&FC

Class TResultSet

Represents the result of a query. The result is the ordered set of records resulting from a SQL query. Instances of TResultSet are created by a call to the TStatement query method.

A TResultSet can be thought of as a cursor that at any given moment points to a record of the result. Before the first call to the next method the cursor points to just before the first record. That means only after the first call to the next method the contents of the first record can be retrieved.

When the TResultSet is positioned on a record its fields can be retrieved using the getXXX methods.

Method Summary
close
         Closes this result set and releases all the database resources held by the object.
getColumnCount
         Retrieves the number of columns in this result set.
getColumnName columnIndex
         Retrieves the name of one of the columns in this result set.
getDate columnIndex
getDate columnName
         Fetches as a date object the contents of one of the columns of the record at the cursor current position.
getFloat columnIndex
getFloat columnName
         Fetches as a float the contents of one of the columns of the record at the result set current cursor position.
getInt columnIndex
getInt columnName
         Fetches as an integer the contents of one of the columns of the record at the result set current cursor position.
getString columnIndex
getString columnName
         Fetches as a string the contents of one of the columns of the record at the cursor current position.
hasMoreRows
         Checks if this TResultSet still has more records to retrieve.
hasRows
         Checks if this TResultSet has any records.
next
         Advances the cursor current position by one to the next record of the result.
skip count
         Advances the cursor current position by count positions.

Method Detail

close

TResultSet close

Closes this result set and releases all the database resources held by the object.

Releases all the database resources used by this object. The object can then no longer be used.

getColumnCount

TResultSet getColumnCount

Retrieves the number of columns in this result set.

Returns:
An integer object representing the number of columns in this result set.


getColumnName

TResultSet getColumnName columnIndex

Retrieves the name of one of the columns in this result set.

Parameters:
columnIndex - Integer representing the index of the column whose name will be retrieved. The first column has index 1.
Returns:
A string with the column name.

The value returned by this method could be used as argument to one of the getXXX methods to retrieve the value of one of the fields in the result set.

getDate

TResultSet getDate columnIndex
TResultSet getDate columnName

Fetches as a date object the contents of one of the columns of the record at the cursor current position.

Parameters:
columnIndex - Integer representing the index of the column to retrieve. The first field has index 1.
columnName - The name of the column to retrieve. This should be the same string returned by a call to the TResultSet getColumnName method.
Returns:
A date object representing the contents of the field. If the field is null in the database then the null object is returned.

Retrieves the contents of one of the fields of the record at the result set current cursor position. The field can be designated either by its index or by its name.

If the columnIndex argument is less than one or greater than the number of fields then a runtime error is generated.

The field to retrieve can be of any type in the database that can be converted to a date.

Since: 3.1.5

getFloat

TResultSet getFloat columnIndex
TResultSet getFloat columnName

Fetches as a float the contents of one of the columns of the record at the result set current cursor position.

Parameters:
columnIndex - Integer representing the index of the column to retrieve. The first field has index 1.
columnName - The name of the column to retrieve. This should be the same string returned by a call to the TResultSet getColumnName method.
Returns:
A float object corresponding to the contents of the field. If the field is null in the database then the zero value is returned.

Retrieves the contents of one of the fields of the record at the result set current cursor position. The field can be designated either by its index or by its name.

If the columnIndex argument is less than one or greater than the number of fields then a runtime error is generated.

The field to retrieve can be of any type in the database that can be converted to a float. If that is not the case then a runtime error is generated.


getInt

TResultSet getInt columnIndex
TResultSet getInt columnName

Fetches as an integer the contents of one of the columns of the record at the result set current cursor position.

Parameters:
columnIndex - Integer representing the index of the column to retrieve. The first field has index 1.
columnName - The name of the column to retrieve. This should be the same string returned by a call to the TResultSet getColumnName method.
Returns:
An integer object corresponding to the contents of the field. If the field is null in the database then the zero value is returned.

Retrieves the contents of one of the fields of the record at the result set current cursor position. The field can be designated either by its index or by its name.

If the columnIndex argument is less than one or greater than the number of fields then a runtime error is generated.

The field to retrieve can be of any type in the database that can be converted to an integer. If that is not the case then a runtime error is generated.


getString

TResultSet getString columnIndex
TResultSet getString columnName

Fetches as a string the contents of one of the columns of the record at the cursor current position.

Parameters:
columnIndex - Integer representing the index of the column to retrieve. The first field has index 1.
columnName - The name of the column to retrieve. This should be the same string returned by a call to the TResultSet getColumnName method.
Returns:
A string object representing the contents of the field. If the field is null in the database then the null object is returned.

Retrieves the contents of one of the fields of the record at the result set current cursor position. The field can be designated either by its index or by its name.

If the columnIndex argument is less than one or greater than the number of fields then a runtime error is generated.

The field to retrieve can be of any type in the database that can be converted to a string.


hasMoreRows

TResultSet hasMoreRows

Checks if this TResultSet still has more records to retrieve.

Returns:
True if there are more records to retrieve. False otherwise.

This method is similar to the next method but it does not advance the cursor. This means that if a call to returns true then the next call to next will also return true.

hasRows

TResultSet hasRows

Checks if this TResultSet has any records.

Returns:
True if there were any records in the result of the query. False otherwise.

This method always return the same value, either true or false, for a given instance of TResultSet.

next

TResultSet next

Advances the cursor current position by one to the next record of the result.

Returns:
True if the cursor was successfully advanced to the next record. False if there are no more records in the result set.

This method must be called at least once prior to retrieving any record fields by calls to the getXXX methods.

skip

TResultSet skip count

Advances the cursor current position by count positions.

Parameters:
count - Integer representing the number of positions the cursor will be advanced by.

This method is equivalent to calling the next method count times, after the first call to the next method.


Overview Module Function Class Tea 3.2.4 Reference Documentation
© 2009 PDM&FC
Report a bug or request new features
© 2009