motion-sqlite3 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 199d13b845e8cdabee64303b840f750d37b928f7
4
- data.tar.gz: 4338619fbf94ed9cfb7632dd62a0bc600bee9ab2
3
+ metadata.gz: 69c11ae39a27fe5ca7b2bb6365e464a661fba96e
4
+ data.tar.gz: 4548214b6206147f2ddb069bd36b3eba6afa02b1
5
5
  SHA512:
6
- metadata.gz: 8f0d2a9b7d65bf8d8b9340df35f5d2f264dd01b5b3c355c2e030dc64c991aa359fb3df3751cb31f62ff97452a449e13a4732186b552c50c232b205ea0fa12e24
7
- data.tar.gz: 57afec7a3299a6d29fc5a17707e9f2e99f905d08b048174123784806ed03bbd0141ff19c827ef891b835a1bc17c6b404da5ecffc6fc049f84a8fa067a876a682
6
+ metadata.gz: 13e8288e59470b914ff988da4424f42c29e6a13bb8c13608f216296657122c8c0812e763f1f15044cf202c333a9938741bf866fc045b18215b2a42e4ba49d37b
7
+ data.tar.gz: 66c9f6e74c7c7955f5feb7ab6c8580f7cc12607aa7834b980f652624fc834fa1822e5021246e05ec5975d5bf1e5365237501876fbcb7a0506a0f832e653b1085
@@ -16,19 +16,17 @@ module SQLite3
16
16
  private
17
17
 
18
18
  def columns
19
- @result_columns ||= begin
20
- columns = {}
19
+ columns = {}
21
20
 
22
- count = sqlite3_column_count(@handle.value)
23
- 0.upto(count-1) do |i|
24
- name = sqlite3_column_name(@handle.value, i).to_sym
25
- type = sqlite3_column_type(@handle.value, i)
21
+ count = sqlite3_column_count(@handle.value)
22
+ 0.upto(count-1) do |i|
23
+ name = sqlite3_column_name(@handle.value, i).to_sym
24
+ type = sqlite3_column_type(@handle.value, i)
26
25
 
27
- columns[name] = ColumnMetadata.new(i, type)
28
- end
29
-
30
- columns
26
+ columns[name] = ColumnMetadata.new(i, type)
31
27
  end
28
+
29
+ columns
32
30
  end
33
31
 
34
32
  def current_row
@@ -1,3 +1,3 @@
1
1
  module SQLite3
2
- VERSION = "0.5.0"
2
+ VERSION = "0.5.1"
3
3
  end
@@ -24,7 +24,7 @@ describe SQLite3::Database do
24
24
  @db.execute("INSERT INTO test VALUES(:name, :address)", { name: "matt", address: "123 main st" })
25
25
 
26
26
  @db.execute_scalar("SELECT changes()").should == 1
27
- end
27
+ end
28
28
 
29
29
  it "returns rows if no block is provided" do
30
30
  @db.execute("CREATE TABLE test (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, age INTEGER)")
@@ -52,6 +52,19 @@ describe SQLite3::Database do
52
52
  { id: 2, name: "sparky", age: 24 }
53
53
  ]
54
54
  end
55
+
56
+ it "handles results where the first row has a nil column correctly" do
57
+ @db.execute 'create virtual table fts_1 using fts4 (col_1, col_2)'
58
+ @db.execute "insert into fts_1 (col_1) values ('hello')"
59
+ @db.execute "insert into fts_1 (col_2) values ('hello')"
60
+
61
+ rows = @db.execute("select col_1, col_2 from fts_1 where fts_1 match 'hello' order by rowid")
62
+ rows.size.should == 2
63
+ one, two = rows
64
+
65
+ one.should == { col_1: 'hello', col_2: nil }
66
+ two.should == { col_1: nil, col_2: 'hello' }
67
+ end
55
68
  end
56
69
 
57
70
  describe "#execute_scalar" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: motion-sqlite3
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Green
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-18 00:00:00.000000000 Z
11
+ date: 2014-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake