simple-sql 0.5.10 → 0.5.11

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4f76ba8aa94983b8943cc358fbf15e9b66939b68b10e19d15336edc62fbc3c35
4
- data.tar.gz: a5947013464489d1b5c9ce70dfc359c737fe59f7fffaac4cb8512ccb4c040653
3
+ metadata.gz: 7fb2da0d9bc8bb90de22c86ee1a4c24ac147636d59bf40bde909cc703c77b77c
4
+ data.tar.gz: ff4565e646e7e2161216622916a61607846b3f152a58f5ed5235bd23ee2ec674
5
5
  SHA512:
6
- metadata.gz: 38839f6a20c97edb9ee06a432db292c2cc620fdc0d01cb794a0caaf2e8bb542651f33850b9937b8e8e8ccd8139050a3c39a9d44dcef349ac8ccca9462025c26c
7
- data.tar.gz: b8663891f150b32cf7f13550a231eb7fc962c95ec2dbcd9b1f1605bebe32319b6d9b7e7556b6d089ac3c18f698cf4c9e31e8a17417ba00d8beaa503e7ddc06e4
6
+ metadata.gz: d9ed53b930e03aeb47a76afe9cc6a6a1b6ea87e6b95e493a13f94a84517bded96ee8222f9dc44d77acc6eb8ae1deda8eb10312e435853d54fec0eff4591125fc
7
+ data.tar.gz: edb72437b1d17853c64ffd35d80ddb1df5f82400bd2e6db2de01c33dcf394191701faa7477c49a39efd06d681474b8af8fc35bac135017af67455187e39e69d1
@@ -75,4 +75,6 @@ Style/PerlBackrefs:
75
75
 
76
76
  Style/TrailingUnderscoreVariable:
77
77
  Enabled: false
78
-
78
+
79
+ Style/StderrPuts:
80
+ Enabled: false
@@ -50,6 +50,14 @@ class Simple::SQL::Connection
50
50
  key = -key # make it negative
51
51
  end
52
52
 
53
+ # shorten key, key2 to the allowed number of bits
54
+ if key2
55
+ key = apply_bitmask(key, MASK_31_BITS)
56
+ key2 = apply_bitmask(key2, MASK_31_BITS)
57
+ else
58
+ key = apply_bitmask(key, MASK_63_BITS)
59
+ end
60
+
53
61
  if timeout
54
62
  lock_w_timeout(key, key2, timeout)
55
63
  else
@@ -59,6 +67,18 @@ class Simple::SQL::Connection
59
67
 
60
68
  private
61
69
 
70
+ MASK_31_BITS = 0x7fffffff
71
+ MASK_63_BITS = 0x7fffffffffffffff
72
+
73
+ # rubocop:disable Naming/UncommunicativeMethodParamName
74
+ def apply_bitmask(n, mask)
75
+ if n < 0
76
+ -((-n) & mask)
77
+ else
78
+ n & mask
79
+ end
80
+ end
81
+
62
82
  def lock_wo_timeout(key, key2)
63
83
  ask("SET LOCAL lock_timeout TO DEFAULT")
64
84
 
@@ -69,6 +89,7 @@ class Simple::SQL::Connection
69
89
  end
70
90
  end
71
91
 
92
+ # rubocop:disable Style/IfInsideElse
72
93
  def lock_w_timeout(key, key2, timeout)
73
94
  expect! timeout => 0..3600
74
95
 
@@ -1,5 +1,5 @@
1
1
  module Simple
2
2
  module SQL
3
- VERSION = "0.5.10"
3
+ VERSION = "0.5.11"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple-sql
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.10
4
+ version: 0.5.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - radiospiel
@@ -295,7 +295,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
295
295
  - !ruby/object:Gem::Version
296
296
  version: '0'
297
297
  requirements: []
298
- rubygems_version: 3.0.2
298
+ rubyforge_project:
299
+ rubygems_version: 2.7.6
299
300
  signing_key:
300
301
  specification_version: 4
301
302
  summary: SQL with a simple interface