summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJamis Buck <jamis@37signals.com>2008-01-26 17:33:46 +0000
committerJamis Buck <jamis@37signals.com>2008-01-26 17:33:46 +0000
commitd3cdae069ec5e416737bae1593009ca89c163046 (patch)
tree24ee93fb46237128a3779bb6f198ab697e9b5103
parent03e32bf5a3d191361315a1e57ebf762e5b15b8c9 (diff)
downloadthird_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.rb13
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 )