motion-sqlite3 0.5.0 → 0.5.1
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 +4 -4
- data/lib/motion-sqlite3/result_set.rb +8 -10
- data/lib/motion-sqlite3/version.rb +1 -1
- data/spec/database_spec.rb +14 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 69c11ae39a27fe5ca7b2bb6365e464a661fba96e
|
4
|
+
data.tar.gz: 4548214b6206147f2ddb069bd36b3eba6afa02b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
20
|
-
columns = {}
|
19
|
+
columns = {}
|
21
20
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
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
|
-
|
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
|
data/spec/database_spec.rb
CHANGED
@@ -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.
|
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-
|
11
|
+
date: 2014-02-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|