summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/sqlite3/translator.rb1
-rw-r--r--test/tc_integration.rb7
2 files changed, 8 insertions, 0 deletions
diff --git a/lib/sqlite3/translator.rb b/lib/sqlite3/translator.rb
index 1ee315e..14d28b6 100644
--- a/lib/sqlite3/translator.rb
+++ b/lib/sqlite3/translator.rb
@@ -81,6 +81,7 @@ module SQLite3
# A convenience method for working with type names. This returns the "base"
# type name, without any parenthetical data.
def type_name( type )
+ return "" if type.nil?
type = $1 if type =~ /^(.*?)\(/
type.upcase
end
diff --git a/test/tc_integration.rb b/test/tc_integration.rb
index e55b5a1..514ffe2 100644
--- a/test/tc_integration.rb
+++ b/test/tc_integration.rb
@@ -889,6 +889,13 @@ module Integration
assert_equal [ 1, "foo" ], @result.next
end
+ define_method( "test_next_type_translation_with_untyped_column" ) do
+ @db.type_translation = true
+ @db.query( "select count(*) from foo" ) do |result|
+ assert_equal ["3"], result.next
+ end
+ end
+
define_method( "test_next_results_as_hash" ) do
@db.results_as_hash = true
@result.reset( 1 )