activerecord-trilogy-adapter 2.0.0 → 2.1.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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f6012f06cd5bd29a7bd180354fd0e65c3fd11784a6a7483fac9599d87baa1b68
|
4
|
+
data.tar.gz: bde2129ca1f647d6b7308c131d00ae012d614ad4aba36450f16fd3551bc303ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ae12198df3991bccc1a17a983050457b2483d33f40078d5bd4c99a2d475d5fbdb84a2510c0beb0db65c9ebb4e431e12115ab2830c0cd5901a75cea3dfd7f75a
|
7
|
+
data.tar.gz: 0aed27beca07c98b513a092345b125129999f5ec0180ee9df0c78b39348c73be71ef0ad78448a644733f8966636f8059ec43aa248b247e66fa7cfda2cb3bdae8
|
@@ -70,13 +70,32 @@ module ActiveRecord
|
|
70
70
|
|
71
71
|
include DatabaseStatements
|
72
72
|
|
73
|
+
SSL_MODES = {
|
74
|
+
SSL_MODE_DISABLED: Trilogy::SSL_DISABLED,
|
75
|
+
SSL_MODE_PREFERRED: Trilogy::SSL_PREFERRED_NOVERIFY,
|
76
|
+
SSL_MODE_REQUIRED: Trilogy::SSL_REQUIRED_NOVERIFY,
|
77
|
+
SSL_MODE_VERIFY_CA: Trilogy::SSL_VERIFY_CA,
|
78
|
+
SSL_MODE_VERIFY_IDENTITY: Trilogy::SSL_VERIFY_IDENTITY
|
79
|
+
}.freeze
|
80
|
+
|
73
81
|
class << self
|
74
82
|
def new_client(config)
|
83
|
+
config[:ssl_mode] = parse_ssl_mode(config[:ssl_mode]) if config[:ssl_mode]
|
75
84
|
::Trilogy.new(config)
|
76
85
|
rescue Trilogy::DatabaseError => error
|
77
86
|
raise translate_connect_error(config, error)
|
78
87
|
end
|
79
88
|
|
89
|
+
def parse_ssl_mode(mode)
|
90
|
+
return mode if mode.is_a? Integer
|
91
|
+
|
92
|
+
m = mode.to_s.upcase
|
93
|
+
# enable Mysql2 client compatibility
|
94
|
+
m = "SSL_MODE_#{m}" unless m.start_with? "SSL_MODE_"
|
95
|
+
|
96
|
+
SSL_MODES.fetch(m.to_sym, mode)
|
97
|
+
end
|
98
|
+
|
80
99
|
def translate_connect_error(config, error)
|
81
100
|
case error.error_code
|
82
101
|
when ER_BAD_DB_ERROR
|
@@ -116,7 +135,9 @@ module ActiveRecord
|
|
116
135
|
end
|
117
136
|
|
118
137
|
def quote_string(string)
|
119
|
-
|
138
|
+
with_raw_connection(allow_retry: true, uses_transaction: false) do |conn|
|
139
|
+
conn.escape(string)
|
140
|
+
end
|
120
141
|
end
|
121
142
|
|
122
143
|
def active?
|
@@ -199,7 +220,9 @@ module ActiveRecord
|
|
199
220
|
end
|
200
221
|
|
201
222
|
def get_full_version
|
202
|
-
|
223
|
+
with_raw_connection(allow_retry: true, uses_transaction: false) do |conn|
|
224
|
+
conn.server_info[:version]
|
225
|
+
end
|
203
226
|
end
|
204
227
|
|
205
228
|
def translate_exception(exception, message:, sql:, binds:)
|
@@ -208,6 +231,10 @@ module ActiveRecord
|
|
208
231
|
::TrilogyAdapter::LostConnectionExceptionTranslator.
|
209
232
|
new(exception, message, error_code).translate || super
|
210
233
|
end
|
234
|
+
|
235
|
+
def default_prepared_statements
|
236
|
+
false
|
237
|
+
end
|
211
238
|
end
|
212
239
|
end
|
213
240
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-trilogy-adapter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GitHub Engineering
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-09-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: trilogy
|
@@ -28,16 +28,16 @@ dependencies:
|
|
28
28
|
name: activerecord
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 7.1.
|
33
|
+
version: 7.1.a
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 7.1.
|
40
|
+
version: 7.1.a
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: minitest
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -136,7 +136,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
136
136
|
- !ruby/object:Gem::Version
|
137
137
|
version: '0'
|
138
138
|
requirements: []
|
139
|
-
rubygems_version: 3.
|
139
|
+
rubygems_version: 3.2.33
|
140
140
|
signing_key:
|
141
141
|
specification_version: 4
|
142
142
|
summary: Active Record adapter for https://github.com/github/trilogy.
|