Class: IBRuby::ResultSet

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/src.rb

Overview

This class represents the results of a SQL query executed against a database. The viable lifespan of a ResultSet object is limited by the transaction that was used in it’s creation. Once this transaction has been committed or rolled back all related ResultSet object are invalidated and can no longer be used.

Instance Method Summary collapse

Constructor Details

#initialize(connection, transaction, sql, dialect) ⇒ ResultSet

This is the constructor for the ResultSet object.

Parameters

connection

A reference to the Connection object that will be used to execute the SQL query.

transaction

A reference to the Transaction object that will be used in executing the SQL query.

sql

A reference to a String containing the SQL query that will be executed.

dialect

A reference to an integer containing the InterBase dialect to be used in executing the SQL statement.

Exceptions

IBRubyException

Generated whenever a non-query SQL statement is

specified, an invalid connection or transaction is
provided or a problem occurs executing the SQL
against the database.


706
707
# File 'lib/src.rb', line 706

def initialize(connection, transaction, sql, dialect)
end

Instance Method Details

#closeObject

This method releases the database resources associated with a ResultSet object and should be explicitly called when a ResultSet object is of no further use. The method is implicitly called if the rows available from a ResultSet are exhausted but calling this method at that time will not cause an error.

Exceptions

IBRubyError

Generated whenever a problem occurs closing the result

set object.


836
837
# File 'lib/src.rb', line 836

def close
end

#column_alias(column) ⇒ Object

This method fetches the alias associated with a specified column for a ResultSet object.

Parameters

column

A reference to the column number to fetch the details for. Column numbers start at zero.



766
767
# File 'lib/src.rb', line 766

def column_alias(column)
end

#column_countObject

This method fetches a count of the number of columns in a row of data that the ResultSet can fetch.



742
743
# File 'lib/src.rb', line 742

def column_count
end

#column_name(column) ⇒ Object

This method fetches the name associated with a specified column for a ResultSet object.

Parameters

column

A reference to the column number to fetch the details for. Column numbers start at zero.



754
755
# File 'lib/src.rb', line 754

def column_name(column)
end

#column_table(column) ⇒ Object

This method fetches the table name associated with a specified column for a ResultSet object.

Parameters

column

A reference to the column number to fetch the details for. Column numbers start at zero.



778
779
# File 'lib/src.rb', line 778

def column_table(column)
end

#connectionObject

This is the accessor for the connection attribute.



713
714
# File 'lib/src.rb', line 713

def connection
end

#dialectObject

This is the accessor for the dialect attribute.



734
735
# File 'lib/src.rb', line 734

def dialect
end

#each(&block) ⇒ Object

This method provides an iterator for the (remaining) rows contained in a ResultSet object.

Parameters

block

A block that takes a single parameter. This will be called for and passed each remaining row (as per the fetch method) from the ResultSet.



821
822
# File 'lib/src.rb', line 821

def each(&block)
end

#exhausted?Boolean

This method is used to determine if all of the rows have been retrieved from a ResultSet object. This method will always return false until the fetch method has been called at least once so it cannot be used to detect a result set that returns no rows.

Returns:

  • (Boolean)


800
801
# File 'lib/src.rb', line 800

def exhausted?
end

#fetchObject

This method fetches a single rows worth of data from the ResultSet object. If the set contains more rows then an array containing the row data will be retrieved. If the ResultSet is exhausted (i.e. all rows have been fetched) then nil is returned. Translation of the row data into an appropriate Ruby type is performed on the row data that is extracted.



790
791
# File 'lib/src.rb', line 790

def fetch
end

#get_base_type(index) ⇒ Object

This method retrieves the base SQL type for a column of data within a ResultSet object. The method returns one of the base types defined in the SQLType class but does not return an actual SQLType object.

Parameters

index

The offset from the ResultSet first column of the column to return the type information for.



848
849
# File 'lib/src.rb', line 848

def get_base_type(index)
end

#row_countObject

This method fetches a count of the total number of rows retrieved from a result set.



808
809
# File 'lib/src.rb', line 808

def row_count
end

#sqlObject

This is the accessor for the sql attribute.



727
728
# File 'lib/src.rb', line 727

def sql
end

#transactionObject

This is the accessor for the transaction attribute.



720
721
# File 'lib/src.rb', line 720

def transaction
end