Sha256: dc844c69b91b8bee7b272dd58c94b0ccec69df4ba6c059a8fe9aeb7012389a07

Contents?: true

Size: 978 Bytes

Versions: 294

Compression:

Stored size: 978 Bytes

Contents

require 'helper'

module SQLite3
  class TestResultSet < SQLite3::TestCase
    def test_each_hash
      db = SQLite3::Database.new ':memory:'
      db.execute "create table foo ( a integer primary key, b text )"
      list = ('a'..'z').to_a
      list.each do |t|
        db.execute "insert into foo (b) values (\"#{t}\")"
      end

      rs = db.prepare('select * from foo').execute
      rs.each_hash do |hash|
        assert_equal list[hash['a'] - 1], hash['b']
      end
    end

    def test_next_hash
      db = SQLite3::Database.new ':memory:'
      db.execute "create table foo ( a integer primary key, b text )"
      list = ('a'..'z').to_a
      list.each do |t|
        db.execute "insert into foo (b) values (\"#{t}\")"
      end

      rs = db.prepare('select * from foo').execute
      rows = []
      while row = rs.next_hash
        rows << row
      end
      rows.each do |hash|
        assert_equal list[hash['a'] - 1], hash['b']
      end
    end
  end
end

Version data entries

294 entries across 257 versions & 25 rubygems

Version Path
lg_pod_plugin-1.1.6.7 lib/sqlite3-1.5.3-arm64-darwin/test/test_result_set.rb
lg_pod_plugin-1.1.6.7 lib/sqlite3-1.5.3-x86_64-darwin/test/test_result_set.rb
lg_pod_plugin-1.1.6.6 lib/sqlite3-1.5.3-arm64-darwin/test/test_result_set.rb
lg_pod_plugin-1.1.6.6 lib/sqlite3-1.5.3-x86_64-darwin/test/test_result_set.rb
lg_pod_plugin-1.1.6.5 lib/sqlite3-1.5.3-x86_64-darwin/test/test_result_set.rb
lg_pod_plugin-1.1.6.5 lib/sqlite3-1.5.3-arm64-darwin/test/test_result_set.rb
lg_pod_plugin-1.1.6.4 lib/sqlite3-1.5.3-arm64-darwin/test/test_result_set.rb
lg_pod_plugin-1.1.6.4 lib/sqlite3-1.5.3-x86_64-darwin/test/test_result_set.rb
sqlite3-1.6.2 test/test_result_set.rb
sqlite3-1.6.2-x86_64-linux test/test_result_set.rb
sqlite3-1.6.2-x86_64-darwin test/test_result_set.rb
sqlite3-1.6.2-x86-linux test/test_result_set.rb
sqlite3-1.6.2-x64-mingw32 test/test_result_set.rb
sqlite3-1.6.2-x64-mingw-ucrt test/test_result_set.rb
sqlite3-1.6.2-arm64-darwin test/test_result_set.rb
sqlite3-1.6.2-arm-linux test/test_result_set.rb
sqlite3-1.6.2-aarch64-linux test/test_result_set.rb
lg_pod_plugin-1.1.6.3 lib/sqlite3-1.5.3-arm64-darwin/test/test_result_set.rb
lg_pod_plugin-1.1.6.3 lib/sqlite3-1.5.3-x86_64-darwin/test/test_result_set.rb
lg_pod_plugin-1.1.6.2 lib/sqlite3-1.5.3-x86_64-darwin/test/test_result_set.rb