Class: DataObjects::Reader

### Home Classes Methods

### In Files

- lib/data_objects/reader.rb

### Parent

Object

### Methods

- #close
- #each
- #field_count
- #fields
- #next!
- #values

### Included Modules

- Enumerable

### Class/Module Index

Quicksearch

- DataObjects
- DataObjects::Command
- DataObjects::Connection
- DataObjects::ConnectionError
- DataObjects::DataError
- DataObjects::Error
- DataObjects::Extension
- DataObjects::IntegrityError
- DataObjects::Logger
- DataObjects::Logging
- DataObjects::Pooling
- DataObjects::Pooling::InvalidResourceError
- DataObjects::Pooling::Pool
- DataObjects::Quoting
- DataObjects::Reader
- DataObjects::Result
- DataObjects::SQLError
- DataObjects::SavePoint
- DataObjects::Spec
- DataObjects::Spec::PendingHelpers
- DataObjects::SyntaxError
- DataObjects::Transaction
- DataObjects::TransactionError
- DataObjects::URI
- Extlib
- Extlib::ByteArray
- CustomTextType
- MyString
- Object
- SSLHelpers

No matching classes.

# DataObjects::Reader

Abstract class to read rows from a query result

### Public Instance Methods

close() click to toggle source

Close the reader discarding any unread results.

    # File lib/data_objects/reader.rb, line 18
    def close
      raise NotImplementedError.new
    end

each() click to toggle source

Yield each row to the given block as a Hash

    # File lib/data_objects/reader.rb, line 33
    def each
      begin
        while next!
          row = {}
          fields.each_with_index { |field, index| row[field] = values[index] }
          yield row
        end
      ensure
        close
      end
      self
    end

field_count() click to toggle source

Return the number of fields in the result set.

    # File lib/data_objects/reader.rb, line 28
    def field_count
      raise NotImplementedError.new
    end

fields() click to toggle source

Return the array of field names

    # File lib/data_objects/reader.rb, line 8
    def fields
      raise NotImplementedError.new
    end

next!() click to toggle source

Discard the current row (if any) and read the next one (returning true), or return nil if there is no further row.

    # File lib/data_objects/reader.rb, line 23
    def next!
      raise NotImplementedError.new
    end

values() click to toggle source

Return the array of field values for the current row. Not legal after next! has returned false or before it's been called

    # File lib/data_objects/reader.rb, line 13
    def values
      raise NotImplementedError.new
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.