Skip to content

Commit 0cd2e33

Browse files
committed
Add test from PR 1410
1 parent b009d7e commit 0cd2e33

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

spec/mysql2/statement_spec.rb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,14 +184,22 @@ def stmt_count
184184
end
185185

186186
it "should tell us about the fields" do
187-
statement = @client.prepare 'SELECT 1 as foo, 2'
187+
statement = @client.prepare 'SELECT 1 AS foo, 2'
188188
statement.execute
189189
list = statement.fields
190190
expect(list.length).to eq(2)
191191
expect(list.first).to eq('foo')
192192
expect(list[1]).to eq('2')
193193
end
194194

195+
it "should give us fields when no rows" do
196+
statement = @client.prepare 'SELECT 1 AS foo FROM mysql2_test WHERE 1=0'
197+
result = statement.execute
198+
list = result.fields
199+
expect(list.length).to eq(1)
200+
expect(list.first).to eq('foo')
201+
end
202+
195203
it "should handle as a decimal binding a BigDecimal" do
196204
stmt = @client.prepare('SELECT ? AS decimal_test')
197205
test_result = stmt.execute(BigDecimal("123.45")).first

0 commit comments

Comments
 (0)