db 0.10.2 → 0.10.3

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: bdc24fd3f82f67c2497814f94088dd293a31ea6ac31f1e4a2915208d4b93ccf1
4
- data.tar.gz: f9f993cf1f225ca8d959a1a86b97e584dd40e17fc26a6c6f39a8e532d3957ec9
3
+ metadata.gz: 58899749a83841be74872890b6d8486f43edd65cd6fdf03762b9e07e215332a9
4
+ data.tar.gz: 007506f94a8916a886b6e35c46f9003b6a7610fae308c7491b260ce9f5457a80
5
5
  SHA512:
6
- metadata.gz: '0087a87a73f5ae71c9fe5b2fabb864d44a5cac11b6a3d34db73303888b285fd3c592fecb2e37369f07d298fc4096b326a1a0f963e534cceaf82b4d2ff75da7ca'
7
- data.tar.gz: 5f22a3f4e4653864089ad85c7cfeca5e8e3bf0cd9cb383653e114761d49e14e6ffd1e648f567556942269a31ba4f36cd04398fabfc112bc4364e62e1d8793827
6
+ metadata.gz: 1558a94c7975d20124df67b8adf0f39ff9344af6d8ec54d49cfaeddffefe5b0593987fcf604ae41a8d383a730b393b1e8091c41c6a83b412ba9fc5ff495d54bf
7
+ data.tar.gz: f2ab71979b2f5f8e75c108313c8ae74016297f7c7d93aab9b4791085467d3dc37c3b47d3e54e7e610246bc22626e12e77f99afba4a02b6ffd66de26cb1be2fc4
data/lib/db/client.rb CHANGED
@@ -93,10 +93,11 @@ module DB
93
93
  begin
94
94
  yield transaction
95
95
 
96
- transaction.commit
97
96
  rescue
98
97
  transaction.abort
99
98
  raise
99
+ ensure
100
+ transaction.commit?
100
101
  end
101
102
  end
102
103
 
@@ -49,6 +49,10 @@ module DB
49
49
  end
50
50
  end
51
51
 
52
+ def closed?
53
+ @connection.nil?
54
+ end
55
+
52
56
  def query(fragment = String.new, **parameters)
53
57
  if parameters.empty?
54
58
  Query.new(self, fragment)
@@ -31,6 +31,12 @@ module DB
31
31
  self.close
32
32
  end
33
33
 
34
+ def commit?
35
+ unless self.closed?
36
+ self.commit
37
+ end
38
+ end
39
+
34
40
  # Abort the transaction and return the connection to the connection pool.
35
41
  def abort
36
42
  self.call("ROLLBACK")
data/lib/db/version.rb CHANGED
@@ -21,5 +21,5 @@
21
21
  # THE SOFTWARE.
22
22
 
23
23
  module DB
24
- VERSION = "0.10.2"
24
+ VERSION = "0.10.3"
25
25
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: db
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.2
4
+ version: 0.10.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-23 00:00:00.000000000 Z
11
+ date: 2021-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async-io
@@ -113,7 +113,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
113
113
  - !ruby/object:Gem::Version
114
114
  version: '0'
115
115
  requirements: []
116
- rubygems_version: 3.2.3
116
+ rubygems_version: 3.1.2
117
117
  signing_key:
118
118
  specification_version: 4
119
119
  summary: A low level database access gem.