From 6b065bd6b648115ba22436ce000cf0f22842101c Mon Sep 17 00:00:00 2001 From: Santiago Palladino Date: Mon, 28 Mar 2016 20:31:42 -0300 Subject: [PATCH] Handle different number of columns in dummy driver Number of cols is inferred from the number of fields in the first row. --- spec/dummy_driver.cr | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spec/dummy_driver.cr b/spec/dummy_driver.cr index 9bf09f0..f62034d 100644 --- a/spec/dummy_driver.cr +++ b/spec/dummy_driver.cr @@ -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)