Skip to content

Commit

Permalink
Fix unbuffered result set check. (#7)
Browse files Browse the repository at this point in the history
* Add version test.

* Fix issue.
  • Loading branch information
ioquatix authored Jul 26, 2024
1 parent 8e7f57b commit 5f053c5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/db/records.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module DB
class Records
def self.wrap(result)
# We want to avoid extra memory allocations when there are no columns:
if result.field_count == 0 || result.row_count == 0
if result.field_count == 0
return nil
end

Expand Down
10 changes: 10 additions & 0 deletions test/db/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@

let(:client) {DB::Client.new(adapter)}

it "can select version" do
context = client.context

result = context.call("SELECT VERSION()")
expect(result).to be_a(DB::Records)

row = result.rows.first
expect(row[0]).to be_a(String)
end

it "can execute multiple queries" do
context = client.context

Expand Down

0 comments on commit 5f053c5

Please sign in to comment.