mirror of
https://gitea.invidious.io/iv-org/shard-crystal-db.git
synced 2024-08-15 00:53:32 +00:00
683e6bdfa7
`#query`, `#exec`, `#scalar`, `#scalar?` as main query methods from `Database` blocks overrides that ensure statements are closed.
20 lines
365 B
Crystal
20 lines
365 B
Crystal
require "spec"
|
|
require "db"
|
|
require "./dummy_driver"
|
|
|
|
describe DB::ResultSet do
|
|
it "should enumerate records using each" do
|
|
nums = [] of Int32
|
|
|
|
with_dummy do |db|
|
|
db.query "3,4 1,2" do |rs|
|
|
rs.each do
|
|
nums << rs.read(Int32)
|
|
nums << rs.read(Int32)
|
|
end
|
|
end
|
|
end
|
|
|
|
nums.should eq([3, 4, 1, 2])
|
|
end
|
|
end
|