simple-sql 0.5.10 → 0.5.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -1
- data/lib/simple/sql/connection/lock.rb +21 -0
- data/lib/simple/sql/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7fb2da0d9bc8bb90de22c86ee1a4c24ac147636d59bf40bde909cc703c77b77c
|
4
|
+
data.tar.gz: ff4565e646e7e2161216622916a61607846b3f152a58f5ed5235bd23ee2ec674
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d9ed53b930e03aeb47a76afe9cc6a6a1b6ea87e6b95e493a13f94a84517bded96ee8222f9dc44d77acc6eb8ae1deda8eb10312e435853d54fec0eff4591125fc
|
7
|
+
data.tar.gz: edb72437b1d17853c64ffd35d80ddb1df5f82400bd2e6db2de01c33dcf394191701faa7477c49a39efd06d681474b8af8fc35bac135017af67455187e39e69d1
|
data/.rubocop.yml
CHANGED
@@ -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
|
|
data/lib/simple/sql/version.rb
CHANGED
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.
|
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
|
-
|
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
|