Handle different number of columns in dummy driver

Number of cols is inferred from the number of fields in the first row.
This commit is contained in:
Santiago Palladino 2016-03-28 20:31:42 -03:00
parent 5773faaa5c
commit 6b065bd6b6

View file

@ -81,6 +81,7 @@ class DummyDriver < DB::Driver
def initialize(statement, query)
super(statement)
@top_values = query.split.map { |r| r.split(',') }.to_a
@column_count = @top_values.size > 0 ? @top_values[0].size : 2
@@last_result_set = self
end
@ -99,7 +100,7 @@ class DummyDriver < DB::Driver
end
def column_count
2
@column_count
end
def column_name(index)