Sha256: fbec0f348c3be072454da66207c1f140a6385a57e5254d8824bd21977e4948ee

Contents?: true

Size: 678 Bytes

Versions: 2

Compression:

Stored size: 678 Bytes

Contents

class Baza::Driver::Sqlite3Java::UnbufferedResult < Baza::ResultBase
  def initialize(driver, result_set)
    @result_set = result_set

    if @result_set
      metadata = @result_set.meta_data
      @columns_count = metadata.column_count

      @columns = []
      1.upto(@columns_count) do |count|
        @columns << metadata.column_name(count).to_sym
      end
    end
  end

  def fetch
    result = @result_set.next if @result_set
    return nil unless result

    hash = {}
    @columns_count.times do |count|
      hash[@columns[count]] = @result_set.string(count + 1)
    end

    return hash
  end

  def each
    while data = fetch
      yield data
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
baza-0.0.19 lib/baza/drivers/sqlite3_java/unbuffered_result.rb
baza-0.0.18 lib/baza/drivers/sqlite3_java/unbuffered_result.rb