motion-sqlite3 1.0.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +1 -1
- data/lib/motion-sqlite3.rb +1 -1
- data/lib/motion-sqlite3/database.rb +3 -3
- data/lib/motion-sqlite3/result_set.rb +7 -7
- data/lib/motion-sqlite3/statement.rb +13 -13
- data/lib/motion-sqlite3/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b019eb6013a8396a0d422ffd1f5eafeb13a580c4f3d30f0e3dc118188b9f6c97
|
4
|
+
data.tar.gz: cb3fcf49b7145ef755eec8756afd78b6cc6c967e735dfacecbbba6d0eadcc590
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a031759f1f4b2724454dd435c29c4eb4cc1b9b6ca009121b7f5891552dbcade4a2f043e3a49bf112ab8310d17885555b983e0e59628144a9a7e1a6c6843b203a
|
7
|
+
data.tar.gz: 3d9f5eeefa0b0e4e7578bf55be7e75ccaf290140a730c6a8117e7cf11844d27118034c63b45ef907b23df2a91406c0365880dd92d349a42aaea2601c31092b3a
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/lib/motion-sqlite3.rb
CHANGED
@@ -1,11 +1,13 @@
|
|
1
1
|
module SQLite3
|
2
2
|
class Database
|
3
|
+
attr_accessor :logging
|
4
|
+
|
3
5
|
def initialize(filename)
|
4
6
|
@handle = Pointer.new(::Sqlite3.type)
|
5
7
|
@logging = false
|
6
8
|
|
7
9
|
result = sqlite3_open(filename, @handle)
|
8
|
-
raise SQLite3Error, sqlite3_errmsg(@handle.
|
10
|
+
raise SQLite3Error, sqlite3_errmsg(@handle.value_with_autorelease) if result != SQLITE_OK
|
9
11
|
end
|
10
12
|
|
11
13
|
def execute(sql, params = nil, &block)
|
@@ -39,8 +41,6 @@ module SQLite3
|
|
39
41
|
execute(*args).first.values.first
|
40
42
|
end
|
41
43
|
|
42
|
-
attr_accessor :logging
|
43
|
-
|
44
44
|
def transaction(&block)
|
45
45
|
execute("BEGIN TRANSACTION")
|
46
46
|
|
@@ -18,22 +18,22 @@ module SQLite3
|
|
18
18
|
def current_row
|
19
19
|
row = {}
|
20
20
|
|
21
|
-
column_count = sqlite3_column_count(@handle.
|
21
|
+
column_count = sqlite3_column_count(@handle.value_with_autorelease)
|
22
22
|
0.upto(column_count - 1) do |i|
|
23
|
-
name = sqlite3_column_name(@handle.
|
24
|
-
type = sqlite3_column_type(@handle.
|
23
|
+
name = sqlite3_column_name(@handle.value_with_autorelease, i).to_sym
|
24
|
+
type = sqlite3_column_type(@handle.value_with_autorelease, i)
|
25
25
|
|
26
26
|
case type
|
27
27
|
when SQLITE_NULL
|
28
28
|
row[name] = nil
|
29
29
|
when SQLITE_TEXT
|
30
|
-
row[name] = sqlite3_column_text(@handle.
|
30
|
+
row[name] = sqlite3_column_text(@handle.value_with_autorelease, i)
|
31
31
|
when SQLITE_BLOB
|
32
|
-
row[name] = NSData.dataWithBytes(sqlite3_column_blob(@handle.
|
32
|
+
row[name] = NSData.dataWithBytes(sqlite3_column_blob(@handle.value_with_autorelease, i), length: sqlite3_column_bytes(@handle.value_with_autorelease, i))
|
33
33
|
when SQLITE_INTEGER
|
34
|
-
row[name] = sqlite3_column_int64(@handle.
|
34
|
+
row[name] = sqlite3_column_int64(@handle.value_with_autorelease, i)
|
35
35
|
when SQLITE_FLOAT
|
36
|
-
row[name] = sqlite3_column_double(@handle.
|
36
|
+
row[name] = sqlite3_column_double(@handle.value_with_autorelease, i)
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
@@ -20,13 +20,13 @@ module SQLite3
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def finalize
|
23
|
-
sqlite3_finalize(@handle.
|
23
|
+
sqlite3_finalize(@handle.value_with_autorelease)
|
24
24
|
end
|
25
25
|
|
26
26
|
def step
|
27
|
-
@result = sqlite3_step(@handle.
|
27
|
+
@result = sqlite3_step(@handle.value_with_autorelease)
|
28
28
|
unless @result == SQLITE_DONE || @result == SQLITE_ROW
|
29
|
-
raise SQLite3Error, sqlite3_errmsg(@db.
|
29
|
+
raise SQLite3Error, sqlite3_errmsg(@db.value_with_autorelease)
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
@@ -49,20 +49,20 @@ module SQLite3
|
|
49
49
|
|
50
50
|
case value
|
51
51
|
when NilClass
|
52
|
-
result = sqlite3_bind_null(@handle.
|
52
|
+
result = sqlite3_bind_null(@handle.value_with_autorelease, index)
|
53
53
|
when String, Symbol
|
54
|
-
result = sqlite3_bind_text(@handle.
|
54
|
+
result = sqlite3_bind_text(@handle.value_with_autorelease, index, value, -1, lambda { |arg| })
|
55
55
|
when Integer
|
56
|
-
result = sqlite3_bind_int64(@handle.
|
56
|
+
result = sqlite3_bind_int64(@handle.value_with_autorelease, index, value)
|
57
57
|
when Float
|
58
|
-
result = sqlite3_bind_double(@handle.
|
59
|
-
when
|
60
|
-
result = sqlite3_bind_blob(@handle.
|
58
|
+
result = sqlite3_bind_double(@handle.value_with_autorelease, index, value)
|
59
|
+
when NSDatavalue
|
60
|
+
result = sqlite3_bind_blob(@handle.value_with_autorelease, index, value.bytes, value.length, lambda { |arg| })
|
61
61
|
else
|
62
62
|
raise SQLite3Error, "unable to bind #{value} to #{name}: unexpected type #{value.class}"
|
63
63
|
end
|
64
64
|
|
65
|
-
raise SQLite3Error, sqlite3_errmsg(@db.
|
65
|
+
raise SQLite3Error, sqlite3_errmsg(@db.value_with_autorelease) if result != SQLITE_OK
|
66
66
|
end
|
67
67
|
|
68
68
|
def column_index(name)
|
@@ -70,7 +70,7 @@ module SQLite3
|
|
70
70
|
|
71
71
|
case name
|
72
72
|
when String, Symbol
|
73
|
-
index = sqlite3_bind_parameter_index(@handle.
|
73
|
+
index = sqlite3_bind_parameter_index(@handle.value_with_autorelease, ":#{name}")
|
74
74
|
raise SQLite3Error, "couldn't find index for #{name}!" if index == 0
|
75
75
|
|
76
76
|
when Integer
|
@@ -82,8 +82,8 @@ module SQLite3
|
|
82
82
|
|
83
83
|
def prepare(sql)
|
84
84
|
remainder = Pointer.new(:string)
|
85
|
-
result = sqlite3_prepare_v2(@db.
|
86
|
-
raise SQLite3Error, sqlite3_errmsg(@db.
|
85
|
+
result = sqlite3_prepare_v2(@db.value_with_autorelease, sql, -1, @handle, remainder)
|
86
|
+
raise SQLite3Error, sqlite3_errmsg(@db.value_with_autorelease) if result != SQLITE_OK
|
87
87
|
end
|
88
88
|
end
|
89
89
|
end
|
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:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Green
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-03-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -80,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
80
80
|
- !ruby/object:Gem::Version
|
81
81
|
version: '0'
|
82
82
|
requirements: []
|
83
|
-
rubygems_version: 3.
|
83
|
+
rubygems_version: 3.1.2
|
84
84
|
signing_key:
|
85
85
|
specification_version: 4
|
86
86
|
summary: A minimal wrapper over the SQLite 3 C API for RubyMotion
|