motion-sqlite3 0.4.2 → 0.5.0
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/database.rb +7 -9
- data/lib/motion-sqlite3/version.rb +1 -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: 199d13b845e8cdabee64303b840f750d37b928f7
|
4
|
+
data.tar.gz: 4338619fbf94ed9cfb7632dd62a0bc600bee9ab2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f0d2a9b7d65bf8d8b9340df35f5d2f264dd01b5b3c355c2e030dc64c991aa359fb3df3751cb31f62ff97452a449e13a4732186b552c50c232b205ea0fa12e24
|
7
|
+
data.tar.gz: 57afec7a3299a6d29fc5a17707e9f2e99f905d08b048174123784806ed03bbd0141ff19c827ef891b835a1bc17c6b404da5ecffc6fc049f84a8fa067a876a682
|
@@ -2,6 +2,7 @@ module SQLite3
|
|
2
2
|
class Database
|
3
3
|
def initialize(filename)
|
4
4
|
@handle = Pointer.new(::Sqlite3.type)
|
5
|
+
@logging = false
|
5
6
|
|
6
7
|
result = sqlite3_open(filename, @handle)
|
7
8
|
raise SQLite3Error, sqlite3_errmsg(@handle.value) if result != SQLITE_OK
|
@@ -10,8 +11,10 @@ module SQLite3
|
|
10
11
|
def execute(sql, params = nil, &block)
|
11
12
|
raise ArgumentError if sql.nil?
|
12
13
|
|
13
|
-
|
14
|
-
|
14
|
+
if @logging
|
15
|
+
puts " SQL: #{sql}"
|
16
|
+
puts "Params: #{params}" if params && ! params.empty?
|
17
|
+
end
|
15
18
|
|
16
19
|
prepare(sql, params) do |statement|
|
17
20
|
results = statement.execute
|
@@ -32,17 +35,12 @@ module SQLite3
|
|
32
35
|
end
|
33
36
|
end
|
34
37
|
|
35
|
-
def execute_debug(*args, &block)
|
36
|
-
puts "*** #{args[0]}"
|
37
|
-
puts " #{args[1].inspect}" if args[1]
|
38
|
-
|
39
|
-
execute(*args, &block)
|
40
|
-
end
|
41
|
-
|
42
38
|
def execute_scalar(*args)
|
43
39
|
execute(*args).first.values.first
|
44
40
|
end
|
45
41
|
|
42
|
+
attr_accessor :logging
|
43
|
+
|
46
44
|
def transaction(&block)
|
47
45
|
execute("BEGIN TRANSACTION")
|
48
46
|
|
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.
|
4
|
+
version: 0.5.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: 2014-01-
|
11
|
+
date: 2014-01-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|