diff options
author | Jamis Buck <jamis@37signals.com> | 2008-01-26 17:33:46 +0000 |
---|---|---|
committer | Jamis Buck <jamis@37signals.com> | 2008-01-26 17:33:46 +0000 |
commit | d3cdae069ec5e416737bae1593009ca89c163046 (patch) | |
tree | 24ee93fb46237128a3779bb6f198ab697e9b5103 | |
parent | 03e32bf5a3d191361315a1e57ebf762e5b15b8c9 (diff) | |
download | third_party-sqlite3-ruby-d3cdae069ec5e416737bae1593009ca89c163046.tar.gz third_party-sqlite3-ruby-d3cdae069ec5e416737bae1593009ca89c163046.tar.xz third_party-sqlite3-ruby-d3cdae069ec5e416737bae1593009ca89c163046.zip |
Add test case to show that type translation must explicitly check for nil values
-rw-r--r-- | test/tc_integration.rb | 13 |
1 files changed, 13 insertions, 0 deletions
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 ) |