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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: af35fbc8bd9aa73cd8a574a4adb203f57910b70b9ead0a20144f7d44b171de01
4
- data.tar.gz: c92ffaf547cd920776d5f45c95cb81ce57679b670729d02509123eaed9c190b8
3
+ metadata.gz: b019eb6013a8396a0d422ffd1f5eafeb13a580c4f3d30f0e3dc118188b9f6c97
4
+ data.tar.gz: cb3fcf49b7145ef755eec8756afd78b6cc6c967e735dfacecbbba6d0eadcc590
5
5
  SHA512:
6
- metadata.gz: 4b35565c0e8b8c625afe6106050387c898795291dcb21e7755f03a5dedc8825df7abac2650640143cc03203881fa9f2044eabde6b898c31eac877fbbe853f5fb
7
- data.tar.gz: e47e30b578a2db477e4e4a609c27cf913245a4c31d216bfee48a75c0cd96e4399529907123be047e94e37b2e4cd1597b74fe6bf1692b550630673df609e98d6c
6
+ metadata.gz: a031759f1f4b2724454dd435c29c4eb4cc1b9b6ca009121b7f5891552dbcade4a2f043e3a49bf112ab8310d17885555b983e0e59628144a9a7e1a6c6843b203a
7
+ data.tar.gz: 3d9f5eeefa0b0e4e7578bf55be7e75ccaf290140a730c6a8117e7cf11844d27118034c63b45ef907b23df2a91406c0365880dd92d349a42aaea2601c31092b3a
data/.gitignore CHANGED
@@ -15,3 +15,4 @@ nbproject
15
15
  .sass-cache
16
16
  .idea
17
17
  Gemfile.lock
18
+ pkg
data/.travis.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  language: objective-c
2
- osx_image: xcode11.3
2
+ osx_image: xcode12.4
3
3
  env:
4
4
  global:
5
5
  - RUBYMOTION_LICENSE=1dcac45cc434293009f74b33037bdf7361a3a1ff # Official license key for open-source projects
@@ -10,6 +10,6 @@ Motion::Project::App.setup do |app|
10
10
  app.files.unshift(file)
11
11
  end
12
12
 
13
- app.libs << "/usr/lib/libsqlite3.dylib"
13
+ app.libs << '-lsqlite3'
14
14
  app.include "sqlite3.h"
15
15
  end
@@ -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.value) if result != SQLITE_OK
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.value)
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.value, i).to_sym
24
- type = sqlite3_column_type(@handle.value, i)
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.value, i)
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.value, i), length: sqlite3_column_bytes(@handle.value, i))
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.value, i)
34
+ row[name] = sqlite3_column_int64(@handle.value_with_autorelease, i)
35
35
  when SQLITE_FLOAT
36
- row[name] = sqlite3_column_double(@handle.value, i)
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.value)
23
+ sqlite3_finalize(@handle.value_with_autorelease)
24
24
  end
25
25
 
26
26
  def step
27
- @result = sqlite3_step(@handle.value)
27
+ @result = sqlite3_step(@handle.value_with_autorelease)
28
28
  unless @result == SQLITE_DONE || @result == SQLITE_ROW
29
- raise SQLite3Error, sqlite3_errmsg(@db.value)
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.value, index)
52
+ result = sqlite3_bind_null(@handle.value_with_autorelease, index)
53
53
  when String, Symbol
54
- result = sqlite3_bind_text(@handle.value, index, value, -1, lambda { |arg| })
54
+ result = sqlite3_bind_text(@handle.value_with_autorelease, index, value, -1, lambda { |arg| })
55
55
  when Integer
56
- result = sqlite3_bind_int64(@handle.value, index, value)
56
+ result = sqlite3_bind_int64(@handle.value_with_autorelease, index, value)
57
57
  when Float
58
- result = sqlite3_bind_double(@handle.value, index, value)
59
- when NSData
60
- result = sqlite3_bind_blob(@handle.value, index, value.bytes, value.length, lambda { |arg| })
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.value) if result != SQLITE_OK
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.value, ":#{name}")
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.value, sql, -1, @handle, remainder)
86
- raise SQLite3Error, sqlite3_errmsg(@db.value) if result != SQLITE_OK
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
@@ -1,3 +1,3 @@
1
1
  module SQLite3
2
- VERSION = "1.0.0"
2
+ VERSION = "2.0.0"
3
3
  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: 1.0.0
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: 2020-02-13 00:00:00.000000000 Z
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.0.6
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