From d3cdae069ec5e416737bae1593009ca89c163046 Mon Sep 17 00:00:00 2001 From: Jamis Buck Date: Sat, 26 Jan 2008 17:33:46 +0000 Subject: Add test case to show that type translation must explicitly check for nil values --- test/tc_integration.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/tc_integration.rb b/test/tc_integration.rb index 9d78313..6f1c139 100644 --- a/test/tc_integration.rb +++ b/test/tc_integration.rb @@ -948,6 +948,19 @@ module Integration end end + define_method( "test_type_translation_with_null_column" ) do + @db.type_translation = true + @db.execute "create table bar ( a integer, b datetime, c string )" + @db.execute "insert into bar (a, b, c) values (NULL, '1974-07-25 14:39:00', 'hello')" + @db.execute "insert into bar (a, b, c) values (1, NULL, 'hello')" + @db.execute "insert into bar (a, b, c) values (2, '1974-07-25 14:39:00', NULL)" + @db.query( "select * from bar" ) do |result| + assert_equal [nil, Time.local(1974, 7, 25, 14, 39, 0), 'hello'], result.next + assert_equal [1, nil, 'hello'], result.next + assert_equal [2, Time.local(1974, 7, 25, 14, 39, 0), nil], result.next + end + end + define_method( "test_next_results_as_hash" ) do @db.results_as_hash = true @result.reset( 1 ) -- cgit