rsconn 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b7c55afc4e69a211c3122855504748f4be439753
4
- data.tar.gz: 44e3494d5cf588b96095abcf1908397f40457311
3
+ metadata.gz: 7b3dcf4c950d3fe6c929f7953eb683568ca30f51
4
+ data.tar.gz: 73151d3cc5f5a50bc99c7d9bc57e7c427287ebbd
5
5
  SHA512:
6
- metadata.gz: 04dbe812c4431818f1e801756165f6e436507b398dd2be6bfdecd810abea01cc458b6c1f8c09dbaa8a8fd4dfdb6c34ab5d13088e223d78e1b5f52c26c723c276
7
- data.tar.gz: 1dcebc041655cd4890139568cbd6919fff71bf0e5d73b3f2b49cf8de304440a816c993d7fc89d876a6dc8561a7688e58280566acf9693cb2806e13bde0094135
6
+ metadata.gz: d10c89c2365cf91904b5916046fbb6e6d9677796a7aa918cb113b97b3621b404b44b779770d3a17b3728ea65801ae45ae9dc86d9aeae1cc4505c957429dcb496
7
+ data.tar.gz: 1002c1296325b15355dff3562adf2c4badf887090eb8d6757c1845b21fb226f94b91e2bd96ab3f78761481d89afe52b1e1a435d26620bfbf8bea98a76ab5f0bc
@@ -1,3 +1,6 @@
1
+ require 'bigdecimal'
2
+
3
+
1
4
  module Rsconn
2
5
  class TypecastResult
3
6
  attr_reader :result
@@ -34,6 +37,8 @@ module Rsconn
34
37
  end
35
38
 
36
39
  def typecast(type, value)
40
+ return nil if value.nil?
41
+
37
42
  case type
38
43
 
39
44
  when TYPE_BOOLEAN
@@ -1,3 +1,3 @@
1
1
  module Rsconn
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.4'
3
3
  end
@@ -58,7 +58,7 @@ module Rsconn
58
58
  end
59
59
  end
60
60
 
61
- describe '#get_field_by_type' do
61
+ describe '#query' do
62
62
 
63
63
  it 'converts booleans correctly' do
64
64
  @db_conn.execute('CREATE TABLE test.tmp_test_table (tmp boolean)')
@@ -69,6 +69,15 @@ module Rsconn
69
69
  expect(rows[0]['tmp']).to be false
70
70
  expect(rows[1]['tmp']).to be true
71
71
  end
72
+
73
+ it 'converts nulls correctly' do
74
+ @db_conn.execute('CREATE TABLE test.tmp_test_table (a timestamp, b timestamp)')
75
+ @db_conn.execute("INSERT INTO test.tmp_test_table VALUES ('1900-01-01')")
76
+ rows = @db_conn.query('SELECT * FROM test.tmp_test_table')
77
+ @db_conn.drop_table_if_exists('test.tmp_test_table')
78
+
79
+ expect(rows[0]['b']).to be_nil
80
+ end
72
81
  end
73
82
  end
74
83
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rsconn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dean Morin