Sha256: a80baed8806ba2859385450292a6768bcb3f784c5609ae8e98d354257bfee9d5

Contents?: true

Size: 723 Bytes

Versions: 18

Compression:

Stored size: 723 Bytes

Contents

class Baza::Driver::Sqlite3Java::UnbufferedResult < Baza::ResultBase
  def initialize(_driver, result_set)
    @result_set = result_set
    return unless @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

  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

    hash
  end

  def each
    loop do
      data = fetch

      if data
        yield data
      else
        break
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
baza-0.0.38 lib/baza/driver/sqlite3_java/unbuffered_result.rb
baza-0.0.37 lib/baza/driver/sqlite3_java/unbuffered_result.rb
baza-0.0.36 lib/baza/driver/sqlite3_java/unbuffered_result.rb
baza-0.0.35 lib/baza/driver/sqlite3_java/unbuffered_result.rb
baza-0.0.34 lib/baza/driver/sqlite3_java/unbuffered_result.rb
baza-0.0.33 lib/baza/driver/sqlite3_java/unbuffered_result.rb
baza-0.0.32 lib/baza/driver/sqlite3_java/unbuffered_result.rb
baza-0.0.31 lib/baza/driver/sqlite3_java/unbuffered_result.rb
baza-0.0.30 lib/baza/driver/sqlite3_java/unbuffered_result.rb
baza-0.0.29 lib/baza/driver/sqlite3_java/unbuffered_result.rb
baza-0.0.28 lib/baza/driver/sqlite3_java/unbuffered_result.rb
baza-0.0.27 lib/baza/driver/sqlite3_java/unbuffered_result.rb
baza-0.0.26 lib/baza/driver/sqlite3_java/unbuffered_result.rb
baza-0.0.25 lib/baza/driver/sqlite3_java/unbuffered_result.rb
baza-0.0.24 lib/baza/driver/sqlite3_java/unbuffered_result.rb
baza-0.0.23 lib/baza/driver/sqlite3_java/unbuffered_result.rb
baza-0.0.22 lib/baza/driver/sqlite3_java/unbuffered_result.rb
baza-0.0.21 lib/baza/driver/sqlite3_java/unbuffered_result.rb