motion-sqlite3 0.4.2 → 0.5.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
  SHA1:
3
- metadata.gz: 7e0a74bc0800daf89b178fb87be21f66219f768c
4
- data.tar.gz: 4547dd55d44124640428683a15634143dfc13f8a
3
+ metadata.gz: 199d13b845e8cdabee64303b840f750d37b928f7
4
+ data.tar.gz: 4338619fbf94ed9cfb7632dd62a0bc600bee9ab2
5
5
  SHA512:
6
- metadata.gz: 45b9165fab741bba425f3d353a2598919e7ce3cd416a3f59f2973db2ba2ec6f47c46541afba1c53a53b76e2d16b1e317e74be41c162e7516bd31303b1f919bda
7
- data.tar.gz: 035e8edb71aa04c39ebe364476c3161bbcd6591a2826edcca703d889a2820c955c748e5d05bb066e32186f709fe15deed30325314085315fdc5cddc1b2de563f
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
- #puts "*** #{sql}"
14
- #puts " #{params.inspect}" if params
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
 
@@ -1,3 +1,3 @@
1
1
  module SQLite3
2
- VERSION = "0.4.2"
2
+ VERSION = "0.5.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: 0.4.2
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-17 00:00:00.000000000 Z
11
+ date: 2014-01-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake