Class: Rubyfb::ResultSet

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/src.rb,
lib/result_set.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 Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(statement, transaction) ⇒ ResultSet

This is the constructor for the ResultSet object.

Parameters

statement

A reference to the Statement object.

transaction

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

Exceptions

FireRubyException

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.



751
752
# File 'lib/src.rb', line 751

def initialize(statement, transaction)
end

Instance Attribute Details

#row_countObject (readonly)

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



878
879
# File 'lib/src.rb', line 878

def row_count
end

#statementObject (readonly)

This is the accessor for the statement attribute.



771
772
# File 'lib/src.rb', line 771

def statement
end

#transactionObject (readonly)

This is the accessor for the transaction attribute.



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

def transaction
end

Instance Method Details

#active?Boolean

Returns:

  • (Boolean)


95
96
97
# File 'lib/result_set.rb', line 95

def active?
  @active
end

#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

FireRubyError

Generated whenever a problem occurs closing the result set object.



906
907
# File 'lib/src.rb', line 906

def close
end

#column_alias(index) ⇒ 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.



816
817
# File 'lib/src.rb', line 816

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.



792
793
# File 'lib/src.rb', line 792

def column_count
end

#column_name(index) ⇒ 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.



804
805
# File 'lib/src.rb', line 804

def column_name(column)
end

#column_scale(index) ⇒ Object

This method fetches the scale associated with a specified column for a ResultSet object. Firebird implements some floating point types with integral storage and a negative scale. For example, depending on your platform

SELECT 1.003 FROM RDB$DATABASE

may return a ResultSet, the first and only column of which has a base type of :BIGINT but a scale of -3. (Fetches of the actual value will correctly return a ruby Float.)

Parameters

column

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



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

def column_scale(column)
end

#column_table(index) ⇒ 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.



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

def column_table(column)
end

#connectionObject

This is the accessor for the connection attribute.



758
759
# File 'lib/src.rb', line 758

def connection
end

#dialectObject

This is the accessor for the dialect attribute.



784
785
# File 'lib/src.rb', line 784

def dialect
end

#eachObject

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.



891
892
# File 'lib/src.rb', line 891

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)


870
871
# File 'lib/src.rb', line 870

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.



860
861
# File 'lib/src.rb', line 860

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.



918
919
# File 'lib/src.rb', line 918

def get_base_type(index)
end

#initialize_copy(o) ⇒ Object

Raises:



15
16
17
# File 'lib/result_set.rb', line 15

def initialize_copy(o)
  raise FireRubyException.new("Object cloning is not supported");
end

#sqlObject

This is the accessor for the sql attribute.



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

def sql
end