arel_extensions 1.3.9 → 1.3.10

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: 297d1d9b84e726d164e0e001cbe2402c81f3cb1491aa15f10854e508a65d0a8b
4
- data.tar.gz: 23697fa470d0524218097318b9f89a0d78e029e16bdeac5e23b24b6610369f6e
3
+ metadata.gz: 4894bc95053ae6a7c8e12751985e6ae8b0bf0e46fb989c54dfabb96539bfe13f
4
+ data.tar.gz: dfc9e4bacc8ed1000ce83ef49b379794c7c6e9b47b0f87733d92a5e5cce76418
5
5
  SHA512:
6
- metadata.gz: 2e4bffd39e53121a46cf1aacc279747aae8e44119c6cdb3eba1e633e823ee2b3c13596f20139799be6a2ef619b7394aa1e0659569b63643bf08a8516777c84ac
7
- data.tar.gz: 1dc5fadc6064410bff969f77ab61b52308b0c60b2a2009868a40a6055b4194440763fd82a409c9a1b05911106b863ca1cc94066d954db0faf895caa7ce5516ed
6
+ metadata.gz: 6f859b1f5d5273e552dbbbc1e11449ec01c56f668017a1886f69259cf7f24f04293fef8239494e02fcb5595edf4e3ee5139cdca935e39410c9c7d590609ffd2b
7
+ data.tar.gz: 39b2a9818b8231695ea48bfb40b30efcb0c801418475623759bbbdf54cde2c55e5859bc59af37f1cc9a837c4a1422dd3e7b2d07c205d14e5dcf4c4a158056e96
@@ -12,33 +12,39 @@ jobs:
12
12
  strategy:
13
13
  fail-fast: false
14
14
  matrix:
15
- versions: [
16
- {ruby: '3.2', rails: 7_1, arelx: 2},
17
- {ruby: '3.2', rails: 7, arelx: 2},
18
- {ruby: '3.2', rails: 6_1, arelx: 2},
19
- {ruby: '3.1', rails: 7_1, arelx: 2},
20
- {ruby: '3.1', rails: 7, arelx: 2},
21
- {ruby: '3.1', rails: 6_1, arelx: 2},
22
- {ruby: '3.0', rails: 7_1, arelx: 2},
23
- {ruby: '3.0', rails: 7, arelx: 2},
24
- {ruby: '3.0', rails: 6_1, arelx: 2},
25
- {ruby: '2.7', rails: 7_1, arelx: 2},
26
- {ruby: '2.7', rails: 7, arelx: 2},
27
- {ruby: '2.7', rails: 6_1, arelx: 2},
28
- {ruby: '2.7', rails: 6, arelx: 2},
29
- {ruby: '2.7', rails: 5_2, arelx: 1},
30
- {ruby: '2.7', rails: 4_2, arelx: 1},
31
- {ruby: '2.5', rails: 6_1, arelx: 2},
32
- {ruby: '2.5', rails: 6, arelx: 2},
33
- {ruby: '2.5', rails: 5_2, arelx: 1},
34
- {ruby: '2.5', rails: 4_2, arelx: 1},
35
- {ruby: jruby-9.2, rails: 6_1, arelx: 2},
36
- {ruby: jruby-9.2, rails: 6, arelx: 2},
37
- {ruby: jruby-9.2, rails: 5_2, arelx: 1},
38
- {ruby: jruby-9.3, rails: 6_1, arelx: 2},
39
- {ruby: jruby-9.3, rails: 6, arelx: 2},
40
- {ruby: jruby-9.3, rails: 5_2, arelx: 1},
41
- ]
15
+ versions:
16
+ [
17
+ { ruby: "3.3", rails: 7_1, arelx: 2 },
18
+ { ruby: "3.3", rails: 7, arelx: 2 },
19
+ { ruby: "3.3", rails: 6_1, arelx: 2 },
20
+ { ruby: "3.2", rails: 7_1, arelx: 2 },
21
+ { ruby: "3.2", rails: 7, arelx: 2 },
22
+ { ruby: "3.2", rails: 6, arelx: 2 },
23
+ { ruby: "3.2", rails: 6_1, arelx: 2 },
24
+ { ruby: "3.1", rails: 7_1, arelx: 2 },
25
+ { ruby: "3.1", rails: 7, arelx: 2 },
26
+ { ruby: "3.1", rails: 6_1, arelx: 2 },
27
+ { ruby: "3.1", rails: 6, arelx: 2 },
28
+ { ruby: "3.0", rails: 7_1, arelx: 2 },
29
+ { ruby: "3.0", rails: 7, arelx: 2 },
30
+ { ruby: "3.0", rails: 6_1, arelx: 2 },
31
+ { ruby: "2.7", rails: 7_1, arelx: 2 },
32
+ { ruby: "2.7", rails: 7, arelx: 2 },
33
+ { ruby: "2.7", rails: 6_1, arelx: 2 },
34
+ { ruby: "2.7", rails: 6, arelx: 2 },
35
+ { ruby: "2.7", rails: 5_2, arelx: 1 },
36
+ { ruby: "2.7", rails: 4_2, arelx: 1 },
37
+ { ruby: "2.5", rails: 6_1, arelx: 2 },
38
+ { ruby: "2.5", rails: 6, arelx: 2 },
39
+ { ruby: "2.5", rails: 5_2, arelx: 1 },
40
+ { ruby: "2.5", rails: 4_2, arelx: 1 },
41
+ { ruby: jruby-9.2, rails: 6_1, arelx: 2 },
42
+ { ruby: jruby-9.2, rails: 6, arelx: 2 },
43
+ { ruby: jruby-9.2, rails: 5_2, arelx: 1 },
44
+ { ruby: jruby-9.3, rails: 6_1, arelx: 2 },
45
+ { ruby: jruby-9.3, rails: 6, arelx: 2 },
46
+ { ruby: jruby-9.3, rails: 5_2, arelx: 1 },
47
+ ]
42
48
  steps:
43
49
  - uses: actions/checkout@v2
44
50
  - name: Set up Ruby
@@ -68,34 +74,40 @@ jobs:
68
74
  strategy:
69
75
  fail-fast: false
70
76
  matrix:
71
- versions: [
72
- {ruby: '3.2', rails: 7_1, arelx: 2},
73
- {ruby: '3.2', rails: 7, arelx: 2},
74
- {ruby: '3.2', rails: 6_1, arelx: 2},
75
- {ruby: '3.1', rails: 7_1, arelx: 2},
76
- {ruby: '3.1', rails: 7, arelx: 2},
77
- {ruby: '3.1', rails: 6_1, arelx: 2},
78
- {ruby: '3.0', rails: 7_1, arelx: 2},
79
- {ruby: '3.0', rails: 7, arelx: 2},
80
- {ruby: '3.0', rails: 6_1, arelx: 2},
81
- {ruby: '2.7', rails: 7_1, arelx: 2},
82
- {ruby: '2.7', rails: 7, arelx: 2},
83
- {ruby: '2.7', rails: 6_1, arelx: 2},
84
- {ruby: '2.7', rails: 6, arelx: 2},
85
- {ruby: '2.7', rails: 5_2, arelx: 1},
86
- {ruby: '2.7', rails: 4_2, arelx: 1},
87
- {ruby: '2.5', rails: 6_1, arelx: 2},
88
- {ruby: '2.5', rails: 6, arelx: 2},
89
- {ruby: '2.5', rails: 5_2, arelx: 1},
90
- {ruby: '2.5', rails: 4_2, arelx: 1},
91
- {ruby: jruby-9.2, rails: 6_1, arelx: 2},
92
- {ruby: jruby-9.2, rails: 6, arelx: 2},
93
- {ruby: jruby-9.2, rails: 5_2, arelx: 1},
94
- {ruby: jruby-9.2, rails: 4_2, arelx: 1},
95
- {ruby: jruby-9.3, rails: 6_1, arelx: 2},
96
- {ruby: jruby-9.3, rails: 6, arelx: 2},
97
- {ruby: jruby-9.3, rails: 5_2, arelx: 1},
98
- ]
77
+ versions:
78
+ [
79
+ { ruby: "3.3", rails: 7_1, arelx: 2 },
80
+ { ruby: "3.3", rails: 7, arelx: 2 },
81
+ { ruby: "3.3", rails: 6_1, arelx: 2 },
82
+ { ruby: "3.2", rails: 7_1, arelx: 2 },
83
+ { ruby: "3.2", rails: 7, arelx: 2 },
84
+ { ruby: "3.2", rails: 6_1, arelx: 2 },
85
+ { ruby: "3.2", rails: 6, arelx: 2 },
86
+ { ruby: "3.1", rails: 7_1, arelx: 2 },
87
+ { ruby: "3.1", rails: 7, arelx: 2 },
88
+ { ruby: "3.1", rails: 6, arelx: 2 },
89
+ { ruby: "3.1", rails: 6_1, arelx: 2 },
90
+ { ruby: "3.0", rails: 7_1, arelx: 2 },
91
+ { ruby: "3.0", rails: 7, arelx: 2 },
92
+ { ruby: "3.0", rails: 6_1, arelx: 2 },
93
+ { ruby: "2.7", rails: 7_1, arelx: 2 },
94
+ { ruby: "2.7", rails: 7, arelx: 2 },
95
+ { ruby: "2.7", rails: 6_1, arelx: 2 },
96
+ { ruby: "2.7", rails: 6, arelx: 2 },
97
+ { ruby: "2.7", rails: 5_2, arelx: 1 },
98
+ { ruby: "2.7", rails: 4_2, arelx: 1 },
99
+ { ruby: "2.5", rails: 6_1, arelx: 2 },
100
+ { ruby: "2.5", rails: 6, arelx: 2 },
101
+ { ruby: "2.5", rails: 5_2, arelx: 1 },
102
+ { ruby: "2.5", rails: 4_2, arelx: 1 },
103
+ { ruby: jruby-9.2, rails: 6_1, arelx: 2 },
104
+ { ruby: jruby-9.2, rails: 6, arelx: 2 },
105
+ { ruby: jruby-9.2, rails: 5_2, arelx: 1 },
106
+ { ruby: jruby-9.2, rails: 4_2, arelx: 1 },
107
+ { ruby: jruby-9.3, rails: 6_1, arelx: 2 },
108
+ { ruby: jruby-9.3, rails: 6, arelx: 2 },
109
+ { ruby: jruby-9.3, rails: 5_2, arelx: 1 },
110
+ ]
99
111
  steps:
100
112
  - uses: actions/checkout@v2
101
113
  - name: Set up Ruby
@@ -126,33 +138,38 @@ jobs:
126
138
  fail-fast: false
127
139
  matrix:
128
140
  versions: [
129
- {ruby: '3.2', rails: 7_1, arelx: 2},
130
- {ruby: '3.2', rails: 7, arelx: 2},
131
- {ruby: '3.2', rails: 6_1, arelx: 2},
132
- {ruby: '3.1', rails: 7_1, arelx: 2},
133
- {ruby: '3.1', rails: 7, arelx: 2},
134
- {ruby: '3.1', rails: 6_1, arelx: 2},
135
- {ruby: '3.0', rails: 7_1, arelx: 2},
136
- {ruby: '3.0', rails: 7, arelx: 2},
137
- {ruby: '3.0', rails: 6_1, arelx: 2},
138
- {ruby: '2.7', rails: 7_1, arelx: 2},
139
- {ruby: '2.7', rails: 7, arelx: 2},
140
- {ruby: '2.7', rails: 6_1, arelx: 2},
141
- {ruby: '2.7', rails: 6, arelx: 2},
142
- {ruby: '2.7', rails: 5_2, arelx: 1},
143
- {ruby: '2.7', rails: 4_2, arelx: 1},
144
- {ruby: '2.5', rails: 6_1, arelx: 2},
145
- {ruby: '2.5', rails: 6, arelx: 2},
146
- {ruby: '2.5', rails: 5_2, arelx: 1},
147
- {ruby: '2.5', rails: 4_2, arelx: 1},
148
- {ruby: jruby-9.2, rails: 6_1, arelx: 2},
149
- {ruby: jruby-9.2, rails: 6, arelx: 2},
150
- {ruby: jruby-9.2, rails: 5_2, arelx: 1},
151
- {ruby: jruby-9.2, rails: 4_2, arelx: 1},
152
- {ruby: jruby-9.3, rails: 6_1, arelx: 2},
153
- {ruby: jruby-9.3, rails: 6, arelx: 2},
154
- {ruby: jruby-9.3, rails: 5_2, arelx: 1},
155
- ]
141
+ { ruby: "3.3", rails: 7_1, arelx: 2 },
142
+ { ruby: "3.3", rails: 7, arelx: 2 },
143
+ { ruby: "3.3", rails: 6_1, arelx: 2 },
144
+ { ruby: "3.2", rails: 7_1, arelx: 2 },
145
+ { ruby: "3.2", rails: 7, arelx: 2 },
146
+ { ruby: "3.2", rails: 6_1, arelx: 2 },
147
+ # { ruby: "3.2", rails: 6, arelx: 2 }, # cannot test > undefined symbol: rb_tainted_str_new2
148
+ { ruby: "3.1", rails: 7_1, arelx: 2 },
149
+ { ruby: "3.1", rails: 7, arelx: 2 },
150
+ { ruby: "3.1", rails: 6_1, arelx: 2 },
151
+ { ruby: "3.1", rails: 6, arelx: 2 },
152
+ { ruby: "3.0", rails: 7_1, arelx: 2 },
153
+ { ruby: "3.0", rails: 7, arelx: 2 },
154
+ { ruby: "3.0", rails: 6_1, arelx: 2 },
155
+ { ruby: "2.7", rails: 7_1, arelx: 2 },
156
+ { ruby: "2.7", rails: 7, arelx: 2 },
157
+ { ruby: "2.7", rails: 6_1, arelx: 2 },
158
+ { ruby: "2.7", rails: 6, arelx: 2 },
159
+ { ruby: "2.7", rails: 5_2, arelx: 1 },
160
+ { ruby: "2.7", rails: 4_2, arelx: 1 },
161
+ { ruby: "2.5", rails: 6_1, arelx: 2 },
162
+ { ruby: "2.5", rails: 6, arelx: 2 },
163
+ { ruby: "2.5", rails: 5_2, arelx: 1 },
164
+ { ruby: "2.5", rails: 4_2, arelx: 1 },
165
+ { ruby: jruby-9.2, rails: 6_1, arelx: 2 },
166
+ { ruby: jruby-9.2, rails: 6, arelx: 2 },
167
+ { ruby: jruby-9.2, rails: 5_2, arelx: 1 },
168
+ { ruby: jruby-9.2, rails: 4_2, arelx: 1 },
169
+ { ruby: jruby-9.3, rails: 6_1, arelx: 2 },
170
+ { ruby: jruby-9.3, rails: 6, arelx: 2 },
171
+ { ruby: jruby-9.3, rails: 5_2, arelx: 1 },
172
+ ]
156
173
  steps:
157
174
  - uses: actions/checkout@v2
158
175
  # PostgreSQL requires locales to be installed on the system to be able
@@ -208,33 +225,38 @@ jobs:
208
225
  fail-fast: false
209
226
  matrix:
210
227
  versions: [
211
- {ruby: '3.2', rails: 7_1, arelx: 2},
212
- {ruby: '3.2', rails: 7, arelx: 2},
213
- {ruby: '3.2', rails: 6_1, arelx: 2},
214
- {ruby: '3.1', rails: 7_1, arelx: 2},
215
- {ruby: '3.1', rails: 7, arelx: 2},
216
- {ruby: '3.1', rails: 6_1, arelx: 2},
217
- {ruby: '3.0', rails: 7_1, arelx: 2},
218
- {ruby: '3.0', rails: 7, arelx: 2},
219
- {ruby: '3.0', rails: 6_1, arelx: 2},
220
- {ruby: '2.7', rails: 7_1, arelx: 2},
221
- {ruby: '2.7', rails: 7, arelx: 2},
222
- {ruby: '2.7', rails: 6_1, arelx: 2},
223
- {ruby: '2.7', rails: 6, arelx: 2},
224
- {ruby: '2.7', rails: 5_2, arelx: 1},
225
- {ruby: '2.7', rails: 4_2, arelx: 1},
226
- {ruby: '2.5', rails: 6_1, arelx: 2},
227
- {ruby: '2.5', rails: 6, arelx: 2},
228
- {ruby: '2.5', rails: 5_2, arelx: 1},
229
- {ruby: '2.5', rails: 4_2, arelx: 1},
230
- {ruby: jruby-9.2, rails: 6_1, arelx: 2},
231
- {ruby: jruby-9.2, rails: 6, arelx: 2},
232
- {ruby: jruby-9.2, rails: 5_2, arelx: 1},
233
- {ruby: jruby-9.2, rails: 4_2, arelx: 1},
234
- {ruby: jruby-9.3, rails: 6_1, arelx: 2},
235
- {ruby: jruby-9.3, rails: 6, arelx: 2},
236
- {ruby: jruby-9.3, rails: 5_2, arelx: 1},
237
- ]
228
+ { ruby: "3.3", rails: 7_1, arelx: 2 },
229
+ { ruby: "3.3", rails: 7, arelx: 2 },
230
+ { ruby: "3.3", rails: 6_1, arelx: 2 },
231
+ { ruby: "3.2", rails: 7_1, arelx: 2 },
232
+ { ruby: "3.2", rails: 7, arelx: 2 },
233
+ { ruby: "3.2", rails: 6_1, arelx: 2 },
234
+ # { ruby: "3.2", rails: 6, arelx: 2 }, # cannot test > undefined symbol: rb_tainted_str_new2
235
+ { ruby: "3.1", rails: 7_1, arelx: 2 },
236
+ { ruby: "3.1", rails: 7, arelx: 2 },
237
+ { ruby: "3.1", rails: 6_1, arelx: 2 },
238
+ { ruby: "3.1", rails: 6, arelx: 2 },
239
+ { ruby: "3.0", rails: 7_1, arelx: 2 },
240
+ { ruby: "3.0", rails: 7, arelx: 2 },
241
+ { ruby: "3.0", rails: 6_1, arelx: 2 },
242
+ { ruby: "2.7", rails: 7_1, arelx: 2 },
243
+ { ruby: "2.7", rails: 7, arelx: 2 },
244
+ { ruby: "2.7", rails: 6_1, arelx: 2 },
245
+ { ruby: "2.7", rails: 6, arelx: 2 },
246
+ { ruby: "2.7", rails: 5_2, arelx: 1 },
247
+ { ruby: "2.7", rails: 4_2, arelx: 1 },
248
+ { ruby: "2.5", rails: 6_1, arelx: 2 },
249
+ { ruby: "2.5", rails: 6, arelx: 2 },
250
+ { ruby: "2.5", rails: 5_2, arelx: 1 },
251
+ { ruby: "2.5", rails: 4_2, arelx: 1 },
252
+ { ruby: jruby-9.2, rails: 6_1, arelx: 2 },
253
+ { ruby: jruby-9.2, rails: 6, arelx: 2 },
254
+ { ruby: jruby-9.2, rails: 5_2, arelx: 1 },
255
+ { ruby: jruby-9.2, rails: 4_2, arelx: 1 },
256
+ { ruby: jruby-9.3, rails: 6_1, arelx: 2 },
257
+ { ruby: jruby-9.3, rails: 6, arelx: 2 },
258
+ { ruby: jruby-9.3, rails: 5_2, arelx: 1 },
259
+ ]
238
260
  services:
239
261
  mysql:
240
262
  image: mysql:5.7
@@ -285,29 +307,48 @@ jobs:
285
307
  fail-fast: false
286
308
  matrix:
287
309
  versions: [
288
- # {ruby: '3.2', rails: 7, arelx: 2},
289
- {ruby: '3.2', rails: 6_1, arelx: 2},
290
- # {ruby: '3.1', rails: 7, arelx: 2},
291
- {ruby: '3.1', rails: 6_1, arelx: 2},
292
- # {ruby: '3.0', rails: 7, arelx: 2},
293
- {ruby: '3.0', rails: 6_1, arelx: 2},
294
- # {ruby: '2.7', rails: 7, arelx: 2},
295
- {ruby: '2.7', rails: 6_1, arelx: 2},
296
- {ruby: '2.7', rails: 6, arelx: 2},
297
- {ruby: '2.7', rails: 5_2, arelx: 1},
298
- {ruby: '2.7', rails: 4_2, arelx: 1},
299
- {ruby: '2.5', rails: 6_1, arelx: 2},
300
- {ruby: '2.5', rails: 6, arelx: 2},
301
- {ruby: '2.5', rails: 5_2, arelx: 1},
302
- {ruby: '2.5', rails: 4_2, arelx: 1},
303
- # {ruby: jruby-9.2, rails: 6_1, arelx: 2},
304
- # {ruby: jruby-9.2, rails: 6, arelx: 2},
305
- {ruby: jruby-9.2, rails: 5_2, arelx: 1},
306
- {ruby: jruby-9.2, rails: 4_2, arelx: 1},
307
- # {ruby: jruby-9.3, rails: 6_1, arelx: 2},
308
- # {ruby: jruby-9.3, rails: 6, arelx: 2},
309
- {ruby: jruby-9.3, rails: 5_2, arelx: 1},
310
- ]
310
+ { ruby: "3.3", rails: 7_1, arelx: 2 },
311
+ { ruby: "3.3", rails: 7, arelx: 2 },
312
+ { ruby: "3.3", rails: 6_1, arelx: 2 },
313
+ { ruby: "3.3", rails: 6, arelx: 2 },
314
+ { ruby: "3.2", rails: 7_1, arelx: 2 },
315
+ { ruby: "3.2", rails: 7, arelx: 2 },
316
+ { ruby: "3.2", rails: 6_1, arelx: 2 },
317
+ { ruby: "3.2", rails: 6, arelx: 2 },
318
+ { ruby: "3.1", rails: 7_1, arelx: 2 },
319
+ { ruby: "3.1", rails: 7, arelx: 2 },
320
+ { ruby: "3.1", rails: 6_1, arelx: 2 },
321
+ { ruby: "3.1", rails: 6, arelx: 2 },
322
+ { ruby: "3.0", rails: 7, arelx: 2 },
323
+ { ruby: "3.0", rails: 6_1, arelx: 2 },
324
+ { ruby: "3.0", rails: 6, arelx: 2 },
325
+ { ruby: "2.7", rails: 6_1, arelx: 2 },
326
+ { ruby: "2.7", rails: 6, arelx: 2 },
327
+ { ruby: "2.7", rails: 5_2, arelx: 1 },
328
+ { ruby: "2.7", rails: 4_2, arelx: 1 },
329
+ { ruby: "2.5", rails: 6_1, arelx: 2 },
330
+ { ruby: "2.5", rails: 6, arelx: 2 },
331
+ { ruby: "2.5", rails: 5_2, arelx: 1 },
332
+ { ruby: "2.5", rails: 4_2, arelx: 1 },
333
+ # {ruby: jruby-9.2, rails: 6_1, arelx: 2},
334
+ # {ruby: jruby-9.2, rails: 6, arelx: 2},
335
+ { ruby: jruby-9.2, rails: 5_2, arelx: 1 },
336
+ { ruby: jruby-9.2, rails: 4_2, arelx: 1 },
337
+ # See comments on 9.4 to understand why these are disabled for now.
338
+ # {ruby: jruby-9.3, rails: 6_1, arelx: 2},
339
+ # {ruby: jruby-9.3, rails: 6, arelx: 2},
340
+ # {ruby: jruby-9.3, rails: 5_2, arelx: 1},
341
+ { ruby: jruby-9.4, rails: 7_1, arelx: 2 },
342
+ { ruby: jruby-9.4, rails: 7, arelx: 2 },
343
+ #
344
+ # 6 and 6.1 don't work because of a bug in the alt adapter
345
+ # https://github.com/JesseChavez/activerecord-jdbc-adapter/issues/16
346
+ # {ruby: jruby-9.4, rails: 6_1, arelx: 2},
347
+ # {ruby: jruby-9.4, rails: 6, arelx: 2},
348
+ #
349
+ # < 5.2 don't work because of a deeper issue.
350
+ # {ruby: jruby-9.4, rails: 5_2, arelx: 1},
351
+ ]
311
352
  mssql: [2017, 2019]
312
353
  steps:
313
354
  - uses: actions/checkout@v2
data/NEWS.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # News
2
2
 
3
+ ## Release v2.1.10/v1.3.10
4
+
5
+ - MS SQL: add support for jruby 9.4 via [activerecord-jdbc-alt-adapter](https://rubygems.org/gems/activerecord-jdbc-alt-adapter/)
6
+
3
7
  ## Release v2.1.9/v1.3.9
4
8
 
5
9
  ### Bug Fixes
data/README.md CHANGED
@@ -772,7 +772,7 @@ bundle exec rake test:to_sql
772
772
  Refer to the [Version Compatibility](#version-compatibility) section to correctly
773
773
  set your gemfile.
774
774
 
775
- ### MariaDB and Postgres
775
+ ### Testing databases locally
776
776
 
777
777
  We provide a `docker compose` to set up some databases for testing:
778
778
 
data/dev/compose.yaml CHANGED
@@ -27,3 +27,11 @@ services:
27
27
  interval: 10s
28
28
  timeout: 5s
29
29
  retries: 3
30
+ mssql:
31
+ image: mcr.microsoft.com/mssql/server:2019-latest
32
+ container_name: mssql
33
+ environment:
34
+ MSSQL_SA_PASSWORD: Password12!
35
+ ACCEPT_EULA: Y
36
+ ports:
37
+ - "1433:1433"
@@ -20,11 +20,12 @@ group :development, :test do
20
20
  gem 'activerecord-oracle_enhanced-adapter', '~> 6.0.0' if ENV.has_key? 'ORACLE_HOME'
21
21
 
22
22
  # for JRuby
23
- gem 'activerecord-jdbc-adapter', github: 'jruby/activerecord-jdbc-adapter', tag: 'v60.4', platforms: :jruby
24
- gem 'jdbc-sqlite3', platforms: :jruby
25
- gem 'activerecord-jdbcsqlite3-adapter', platforms: :jruby
23
+ gem 'activerecord-jdbc-alt-adapter', '~> 60.0', platform: :jruby, require: true
26
24
  gem 'activerecord-jdbcmysql-adapter', platforms: :jruby
27
25
  gem 'activerecord-jdbcpostgresql-adapter', platforms: :jruby
26
+ gem 'activerecord-jdbcsqlite3-adapter', platforms: :jruby
27
+ gem 'jdbc-mssql', platforms: :jruby, require: true
28
+ gem 'jdbc-sqlite3', platforms: :jruby
28
29
  end
29
30
 
30
31
  gemspec path: Dir.pwd
@@ -20,11 +20,12 @@ group :development, :test do
20
20
  gem 'activerecord-oracle_enhanced-adapter', '~> 6.0.0' if ENV.has_key? 'ORACLE_HOME'
21
21
 
22
22
  # for JRuby
23
- gem 'activerecord-jdbc-adapter', github: 'jruby/activerecord-jdbc-adapter', tag: 'v61.1', platforms: :jruby
24
- gem 'jdbc-sqlite3', platforms: :jruby
25
- gem 'activerecord-jdbcsqlite3-adapter', platforms: :jruby
23
+ gem 'activerecord-jdbc-alt-adapter', '~> 61.0', platform: :jruby, require: true
26
24
  gem 'activerecord-jdbcmysql-adapter', platforms: :jruby
27
25
  gem 'activerecord-jdbcpostgresql-adapter', platforms: :jruby
26
+ gem 'activerecord-jdbcsqlite3-adapter', platforms: :jruby
27
+ gem 'jdbc-mssql', platforms: :jruby, require: true
28
+ gem 'jdbc-sqlite3', platforms: :jruby
28
29
  end
29
30
 
30
31
  gemspec path: Dir.pwd
@@ -13,11 +13,19 @@ group :development, :test do
13
13
  gem 'pg', '~> 1.1', platforms: [:mri]
14
14
 
15
15
  gem 'tiny_tds', platforms: %i[mri mingw x64_mingw mswin]
16
- gem 'activerecord-sqlserver-adapter', '~> 7.0.0.0', platforms: %i[mri mingw x64_mingw mswin]
16
+ gem 'activerecord-sqlserver-adapter', '~> 7.0.7', platforms: %i[mri mingw x64_mingw mswin]
17
17
  gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw]
18
18
 
19
19
  gem 'ruby-oci8', platforms: %i[mri mswin mingw] if ENV.has_key? 'ORACLE_HOME'
20
20
  gem 'activerecord-oracle_enhanced-adapter', '~> 6.0.0' if ENV.has_key? 'ORACLE_HOME'
21
+
22
+ # for JRuby
23
+ gem 'jdbc-mssql', platforms: :jruby, require: true
24
+ gem 'jdbc-sqlite3', platform: :jruby
25
+ gem 'activerecord-jdbc-alt-adapter', '~> 70.0', platform: :jruby, require: true
26
+ gem 'activerecord-jdbcmysql-adapter', platforms: :jruby
27
+ gem 'activerecord-jdbcpostgresql-adapter', platforms: :jruby
28
+ gem 'activerecord-jdbcsqlite3-adapter', platforms: :jruby
21
29
  end
22
30
 
23
31
  gemspec path: Dir.pwd
@@ -17,6 +17,14 @@ group :development, :test do
17
17
 
18
18
  gem 'ruby-oci8', platforms: %i[mri mswin mingw] if ENV.has_key? 'ORACLE_HOME'
19
19
  gem 'activerecord-oracle_enhanced-adapter', '~> 7.0.0' if ENV.has_key? 'ORACLE_HOME'
20
+
21
+ # for JRuby
22
+ gem 'jdbc-mssql', platforms: :jruby, require: true
23
+ gem 'jdbc-sqlite3', platform: :jruby
24
+ gem 'activerecord-jdbc-alt-adapter', '~> 71.0.0.alpha1', platform: :jruby, require: true
25
+ gem 'activerecord-jdbcmysql-adapter', platforms: :jruby
26
+ gem 'activerecord-jdbcpostgresql-adapter', platforms: :jruby
27
+ gem 'activerecord-jdbcsqlite3-adapter', platforms: :jruby
20
28
  end
21
29
 
22
30
  gemspec path: Dir.pwd
@@ -1,3 +1,3 @@
1
1
  module ArelExtensions
2
- VERSION = '1.3.9'.freeze
2
+ VERSION = '1.3.10'.freeze
3
3
  end
@@ -2,52 +2,68 @@ module ArelExtensions
2
2
  module Visitors
3
3
  module MSSQL
4
4
 
5
- mssql_class = Arel::Visitors.constants.select { |c|
6
- Arel::Visitors.const_get(c).is_a?(Class) && %i[MSSQL SQLServer].include?(c)
7
- }.first
8
-
9
- LOADED_VISITOR = Arel::Visitors.const_get(mssql_class) || Arel::Visitors.const_get('MSSQL')
10
-
11
- LOADED_VISITOR::DATE_MAPPING = {
12
- 'd' => 'day', 'm' => 'month', 'y' => 'year', 'wd' => 'weekday', 'w' => 'week', 'h' => 'hour', 'mn' => 'minute', 's' => 'second'
13
- }.freeze
14
-
15
- LOADED_VISITOR::DATE_FORMAT_DIRECTIVES = {
16
- '%Y' => 'YYYY', '%C' => '', '%y' => 'YY', '%m' => 'MM', '%B' => 'month', '%^B' => '', '%b' => '', '%^b' => '', # year, month
17
- '%V' => 'iso_week', '%G' => '', # ISO week number and year of week
18
- '%d' => 'DD', '%e' => '' , '%j' => '' , '%w' => 'dw', %'a' => '', '%A' => 'weekday', # day, weekday
19
- '%H' => 'hh', '%k' => '' , '%I' => '' , '%l' => '' , '%P' => '', '%p' => '', # hours
20
- '%M' => 'mi', '%S' => 'ss', '%L' => 'ms', '%N' => 'ns', '%z' => 'tz'
21
- }.freeze
22
-
23
- LOADED_VISITOR::DATE_FORMAT_FORMAT = {
24
- 'YY' => '0#', 'MM' => '0#', 'DD' => '0#', 'hh' => '0#', 'mi' => '0#', 'ss' => '0#', 'iso_week' => '0#'
25
- }
26
-
27
- LOADED_VISITOR::DATE_NAME = [
28
- '%B', '%A'
29
- ]
30
-
31
- LOADED_VISITOR::DATE_FORMAT_REGEX =
32
- Regexp.new(
33
- LOADED_VISITOR::DATE_FORMAT_DIRECTIVES
34
- .keys
35
- .map{|k| Regexp.escape(k)}
36
- .join('|')
37
- ).freeze
38
-
39
- # TODO; all others... http://www.sql-server-helper.com/tips/date-formats.aspx
40
- LOADED_VISITOR::DATE_CONVERT_FORMATS = {
41
- 'YYYY-MM-DD' => 120,
42
- 'YY-MM-DD' => 120,
43
- 'MM/DD/YYYY' => 101,
44
- 'MM-DD-YYYY' => 110,
45
- 'YYYY/MM/DD' => 111,
46
- 'DD-MM-YYYY' => 105,
47
- 'DD-MM-YY' => 5,
48
- 'DD.MM.YYYY' => 104,
49
- 'YYYY-MM-DDTHH:MM:SS:MMM' => 126
50
- }.freeze
5
+ MSSQL_CLASS_NAMES = %i[MSSQL SQLServer].freeze
6
+
7
+ mssql_class =
8
+ Arel::Visitors
9
+ .constants
10
+ .select { |c| Arel::Visitors.const_get(c).is_a?(Class) }
11
+ .find { |c| MSSQL_CLASS_NAMES.include?(c) }
12
+
13
+ # This guard is necessary because:
14
+ #
15
+ # 1. const_get(mssql_class) will fail when mssql_class is nil.
16
+ # 2. mssql_class could be nil under certain conditions:
17
+ # 1. especially on ruby 2.5 (and surprisingly not jruby 9.2) and 3.0+.
18
+ # 2. when not working with mssql itself.
19
+ if mssql_class
20
+ LOADED_VISITOR = Arel::Visitors.const_get(mssql_class)
21
+
22
+ LOADED_VISITOR::DATE_MAPPING = {
23
+ 'd' => 'day', 'm' => 'month', 'y' => 'year',
24
+ 'wd' => 'weekday', 'w' => 'week',
25
+ 'h' => 'hour', 'mn' => 'minute', 's' => 'second'
26
+ }.freeze
27
+
28
+ LOADED_VISITOR::DATE_FORMAT_DIRECTIVES = {
29
+ '%Y' => 'YYYY', '%C' => '', '%y' => 'YY', '%m' => 'MM', '%B' => 'month', '%^B' => '', '%b' => '', '%^b' => '', # year, month
30
+ '%V' => 'iso_week', '%G' => '', # ISO week number and year of week
31
+ '%d' => 'DD', '%e' => '' , '%j' => '' , '%w' => 'dw', %'a' => '', '%A' => 'weekday', # day, weekday
32
+ '%H' => 'hh', '%k' => '' , '%I' => '' , '%l' => '' , '%P' => '', '%p' => '', # hours
33
+ '%M' => 'mi', '%S' => 'ss', '%L' => 'ms', '%N' => 'ns', '%z' => 'tz'
34
+ }.freeze
35
+
36
+ LOADED_VISITOR::DATE_FORMAT_FORMAT = {
37
+ 'YY' => '0#', 'MM' => '0#', 'DD' => '0#',
38
+ 'hh' => '0#', 'mi' => '0#', 'ss' => '0#',
39
+ 'iso_week' => '0#'
40
+ }
41
+
42
+ LOADED_VISITOR::DATE_NAME = [
43
+ '%B', '%A'
44
+ ]
45
+
46
+ LOADED_VISITOR::DATE_FORMAT_REGEX =
47
+ Regexp.new(
48
+ LOADED_VISITOR::DATE_FORMAT_DIRECTIVES
49
+ .keys
50
+ .map{|k| Regexp.escape(k)}
51
+ .join('|')
52
+ ).freeze
53
+
54
+ # TODO; all others... http://www.sql-server-helper.com/tips/date-formats.aspx
55
+ LOADED_VISITOR::DATE_CONVERT_FORMATS = {
56
+ 'YYYY-MM-DD' => 120,
57
+ 'YY-MM-DD' => 120,
58
+ 'MM/DD/YYYY' => 101,
59
+ 'MM-DD-YYYY' => 110,
60
+ 'YYYY/MM/DD' => 111,
61
+ 'DD-MM-YYYY' => 105,
62
+ 'DD-MM-YY' => 5,
63
+ 'DD.MM.YYYY' => 104,
64
+ 'YYYY-MM-DDTHH:MM:SS:MMM' => 126
65
+ }.freeze
66
+ end
51
67
 
52
68
  # Quoting in JRuby + AR < 5 requires special handling for MSSQL.
53
69
  #
@@ -57,9 +73,10 @@ module ArelExtensions
57
73
  # It didn't handle numbers correctly: `quote(1, nil)` translated into
58
74
  # `N'1'` which we don't want.
59
75
  #
60
- # The following is adapted from activerecord/lib/active_record/connection_adapters/abstract/quoting.rb
76
+ # The following is adapted from
77
+ # https://github.com/rails/rails/blob/main/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb
61
78
  #
62
- if RUBY_PLATFORM == 'java' && ActiveRecord::VERSION::MAJOR < 5
79
+ if RUBY_PLATFORM == 'java'
63
80
  def quote_string(s)
64
81
  s.gsub('\\', '\&\&').gsub("'", "''") # ' (for ruby-mode)
65
82
  end
@@ -70,14 +87,15 @@ module ArelExtensions
70
87
 
71
88
  def quoted_date(value)
72
89
  if value.acts_like?(:time)
73
- if ActiveRecord::Base.default_timezone == :utc
90
+ if (ActiveRecord.respond_to?(:default_timezone) && ActiveRecord.default_timezone == :utc) || ActiveRecord::Base.default_timezone == :utc
74
91
  value = value.getutc if value.respond_to?(:getutc) && !value.utc?
75
92
  else
76
93
  value = value.getlocal if value.respond_to?(:getlocal)
77
94
  end
78
95
  end
79
-
80
- result = value.to_s(:db)
96
+ # new versions of AR use `to_fs`, but we want max compatibility, and we're
97
+ # not going to write it over and over, so it's fine like that.
98
+ result = value.to_formatted_s(:db)
81
99
  if value.respond_to?(:usec) && value.usec > 0
82
100
  result << '.' << sprintf('%06d', value.usec)
83
101
  else
@@ -104,17 +122,19 @@ module ArelExtensions
104
122
  value
105
123
  when String, Symbol, ActiveSupport::Multibyte::Chars
106
124
  "'#{quote_string(value.to_s)}'"
107
- when true
125
+ when true
108
126
  quoted_true
109
- when false
127
+ when false
110
128
  quoted_false
111
- when nil
129
+ when nil
112
130
  'NULL'
113
131
  # BigDecimals need to be put in a non-normalized form and quoted.
114
132
  when BigDecimal
115
133
  value.to_s('F')
116
134
  when Numeric, ActiveSupport::Duration
117
135
  value.to_s
136
+ when Arel::VERSION.to_i > 6 && ActiveRecord::Type::Time::Value
137
+ "'#{quoted_time(value)}'"
118
138
  when Date, Time
119
139
  "'#{quoted_date(value)}'"
120
140
  when Class
@@ -125,6 +145,15 @@ module ArelExtensions
125
145
  end
126
146
  end
127
147
 
148
+ alias_method(:old_primary_Key_From_Table, :primary_Key_From_Table) rescue nil
149
+ def primary_Key_From_Table t
150
+ return unless t
151
+
152
+ column_name = @connection.schema_cache.primary_keys(t.name) ||
153
+ @connection.schema_cache.columns_hash(t.name).first.try(:second).try(:name)
154
+ column_name ? t[column_name] : nil
155
+ end
156
+
128
157
  # Math Functions
129
158
  def visit_ArelExtensions_Nodes_Ceil o, collector
130
159
  collector << 'CEILING('
@@ -543,14 +572,21 @@ module ArelExtensions
543
572
  collector = visit o.left, collector
544
573
  end
545
574
  collector << ' AS '
546
-
547
- # sometimes these values are already quoted, if they are, don't double quote it
548
- quote = o.right.is_a?(Arel::Nodes::SqlLiteral) && o.right[0] != '"' && o.right[-1] != '"'
549
-
550
- collector << '"' if quote
575
+ # Sometimes these values are already quoted, if they are, don't double quote it
576
+ lft, rgt =
577
+ if o.right.is_a?(Arel::Nodes::SqlLiteral)
578
+ if Arel::VERSION.to_i >= 6 && o.right[0] != '[' && o.right[-1] != ']'
579
+ # This is a lie, it's not about arel version, but SQL Server's (>= 2000).
580
+ ['[', ']']
581
+ elsif o.right[0] != '"' && o.right[-1] != '"'
582
+ ['"', '"']
583
+ else
584
+ []
585
+ end
586
+ end
587
+ collector << lft if lft
551
588
  collector = visit o.right, collector
552
- collector << '"' if quote
553
-
589
+ collector << rgt if rgt
554
590
  collector
555
591
  end
556
592
 
@@ -158,10 +158,10 @@ module ArelExtensions
158
158
  collector = visit o.expressions.first, collector
159
159
  collector <<
160
160
  if o.ai
161
- " COLLATE #{charset == 'latin1' ? 'latin1_general_ci' : 'utf8_unicode_ci'}"
161
+ " COLLATE #{charset == 'latin1' ? 'latin1_general_ci' : "#{charset}_unicode_ci"}"
162
162
  # doesn't work in latin1
163
163
  elsif o.ci
164
- " COLLATE #{charset == 'latin1' ? 'latin1_general_ci' : 'utf8_unicode_ci'}"
164
+ " COLLATE #{charset == 'latin1' ? 'latin1_general_ci' : "#{charset}_unicode_ci"}"
165
165
  else
166
166
  " COLLATE #{charset}_bin"
167
167
  end
@@ -1,6 +1,21 @@
1
+ # MSSQL visitors for java and rails ≥ 7 are painful to work with:
2
+ # requiring the exact path to the visitor is needed even if the
3
+ # AR adapter was loaded. It's also needed exactly here because:
4
+ # 1. putting it inside the visitor or anywhere else will not
5
+ # guarantee its actual loading.
6
+ # 2. it needs to load before arel_extensions/visitors.
7
+ if RUBY_PLATFORM == 'java' && Gem::Specification.find { |g| g.name == 'jdbc-mssql' }
8
+ begin
9
+ require 'arel/visitors/sqlserver'
10
+ rescue LoadError
11
+ warn 'arel/visitors/sqlserver not found: MSSQL might not work correctly.'
12
+ end
13
+ end
14
+
1
15
  require 'arel_extensions/visitors/convert_format'
2
16
  require 'arel_extensions/visitors/to_sql'
3
17
  require 'arel_extensions/visitors/mysql'
18
+ require 'arel_extensions/visitors/mssql'
4
19
  require 'arel_extensions/visitors/postgresql'
5
20
  require 'arel_extensions/visitors/sqlite'
6
21
 
@@ -9,10 +24,6 @@ if defined?(Arel::Visitors::Oracle)
9
24
  require 'arel_extensions/visitors/oracle12'
10
25
  end
11
26
 
12
- if defined?(Arel::Visitors::SQLServer) || defined?(Arel::Visitors::MSSQL)
13
- require 'arel_extensions/visitors/mssql'
14
- end
15
-
16
27
  if defined?(Arel::Visitors::SQLServer)
17
28
  class Arel::Visitors::SQLServer
18
29
  include ArelExtensions::Visitors::MSSQL
@@ -27,26 +38,20 @@ if defined?(Arel::Visitors::DepthFirst)
27
38
  end
28
39
  end
29
40
 
41
+ # Especially required here, not inside the next if, for Arel < 6.
42
+ if RUBY_PLATFORM != 'java'
43
+ begin
44
+ require 'arel_sqlserver'
45
+ rescue LoadError
46
+ warn 'gem arel_sqlserver not found: SQLServer Visitor might not work correctly.'
47
+ end
48
+ end
49
+
30
50
  if defined?(Arel::Visitors::MSSQL)
31
51
  class Arel::Visitors::MSSQL
32
52
  include ArelExtensions::Visitors::MSSQL
33
53
 
34
- alias_method(:old_visit_Arel_Nodes_As, :visit_Arel_Nodes_As) rescue nil
35
- def visit_Arel_Nodes_As o, collector
36
- if o.left.is_a?(Arel::Nodes::Binary)
37
- collector << '('
38
- collector = visit o.left, collector
39
- collector << ')'
40
- else
41
- collector = visit o.left, collector
42
- end
43
- collector << ' AS ['
44
- collector = visit o.right, collector
45
- collector << ']'
46
- collector
47
- end
48
-
49
- alias_method(:old_visit_Arel_Nodes_SelectStatement, :visit_Arel_Nodes_SelectStatement) rescue nil
54
+ alias_method(:old_visit_Arel_Nodes_SelectStatement, :visit_Arel_Nodes_SelectStatement)
50
55
  def visit_Arel_Nodes_SelectStatement o, collector
51
56
  if !collector.value.blank? && o.limit.blank? && o.offset.blank?
52
57
  o = o.dup
@@ -55,51 +60,41 @@ if defined?(Arel::Visitors::MSSQL)
55
60
  old_visit_Arel_Nodes_SelectStatement(o, collector)
56
61
  end
57
62
  end
63
+ end
58
64
 
59
- begin
60
- require 'arel_sqlserver'
61
- if Arel::VERSION.to_i == 6
62
- if Arel::Visitors::VISITORS['sqlserver'] && Arel::Visitors::VISITORS['sqlserver'] != Arel::Visitors::MSSQL
63
- Arel::Visitors::VISITORS['sqlserver'].class_eval do
64
- include ArelExtensions::Visitors::MSSQL
65
-
66
- alias_method(:old_visit_Arel_Nodes_SelectStatement, :visit_Arel_Nodes_SelectStatement) rescue nil
67
- def visit_Arel_Nodes_SelectStatement o, collector
68
- if !collector.value.blank? && o.limit.blank? && o.offset.blank?
69
- o = o.dup
70
- o.orders = []
71
- end
72
- old_visit_Arel_Nodes_SelectStatement(o, collector)
73
- end
74
-
75
- alias_method(:old_visit_Arel_Nodes_As, :visit_Arel_Nodes_As) rescue nil
76
- def visit_Arel_Nodes_As o, collector
77
- if o.left.is_a?(Arel::Nodes::Binary)
78
- collector << '('
79
- collector = visit o.left, collector
80
- collector << ')'
81
- else
82
- collector = visit o.left, collector
83
- end
84
- collector << ' AS ['
85
- collector = visit o.right, collector
86
- collector << ']'
87
- collector
88
- end
65
+ if defined?(Arel::Visitors::SQLServer)
66
+ class Arel::Visitors::SQLServer
67
+ include ArelExtensions::Visitors::MSSQL
89
68
 
90
- alias_method(:old_primary_Key_From_Table, :primary_Key_From_Table) rescue nil
91
- def primary_Key_From_Table t
92
- return unless t
69
+ # There's a bug when working with jruby 9.4 that prevents us from
70
+ # refactoring this and putting it in the main module, or even in a separate
71
+ # module then including it.
72
+ #
73
+ # Reason: the line in this file that does:
74
+ #
75
+ # require 'arel_extensions/visitors/mssql'
76
+ #
77
+ # The error could be seen by:
78
+ #
79
+ # 1. placing the visit_ inside the visitor, or placing it in a module
80
+ # then including it here.
81
+ # 2. replacing the `rescue nil` from aliasing trick, and printing the
82
+ # error.
83
+ #
84
+ # It complains that the visit_ does not exist in the module, as if it's
85
+ # evaluating the module eagerly, instead of lazily like in other versions
86
+ # of ruby.
87
+ #
88
+ # It might be something different, but this is the first thing we should
89
+ # investigate.
93
90
 
94
- column_name = @connection.schema_cache.primary_keys(t.name) ||
95
- @connection.schema_cache.columns_hash(t.name).first.try(:second).try(:name)
96
- column_name ? t[column_name] : nil
97
- end
98
- end
91
+ alias_method(:old_visit_Arel_Nodes_SelectStatement, :visit_Arel_Nodes_SelectStatement) rescue nil
92
+ def visit_Arel_Nodes_SelectStatement o, collector
93
+ if !collector.value.blank? && o.limit.blank? && o.offset.blank?
94
+ o = o.dup
95
+ o.orders = []
99
96
  end
97
+ old_visit_Arel_Nodes_SelectStatement(o, collector)
100
98
  end
101
- rescue LoadError
102
- rescue => e
103
- e
104
99
  end
105
100
  end
@@ -12,7 +12,8 @@ end
12
12
 
13
13
  YELLOW = '33'
14
14
 
15
- # Load gems specific to databases
15
+ # Load gems specific to databases.
16
+ #
16
17
  # NOTE:
17
18
  # It's strongly advised to test each database on its own. Loading multiple
18
19
  # backend gems leads to undefined behavior according to tests; the backend
@@ -22,26 +23,32 @@ YELLOW = '33'
22
23
  # The issue also seems to be related to arel version: at some point, arel
23
24
  # dropped its wide support for DBs and kept Postgres, MySQL and SQLite.
24
25
  # Here, we're just trying to load the correct ones.
26
+ #
27
+ # NOTE:
28
+ # As of jruby 9.4 (and maybe 9.3, but I couldn't test it given the state of
29
+ # the alt-adapter), we need to load jdbc/mssql manually.
25
30
  db_and_gem =
26
- if RUBY_ENGINE == 'jruby'
31
+ if RUBY_PLATFORM == 'java'
27
32
  {
28
- 'oracle' => 'activerecord-oracle_enhanced-adapter',
29
- 'mssql' => 'activerecord-jdbcsqlserver-adapter'
33
+ 'oracle' => ['activerecord-oracle_enhanced-adapter'],
34
+ 'mssql' => ['jdbc/mssql', 'activerecord-jdbcsqlserver-adapter'],
30
35
  }
31
36
  else
32
37
  {
33
- 'oracle' => 'activerecord-oracle_enhanced-adapter',
34
- 'mssql' => 'activerecord-sqlserver-adapter'
38
+ 'oracle' => ['activerecord-oracle_enhanced-adapter'],
39
+ 'mssql' => ['activerecord-sqlserver-adapter'],
35
40
  }
36
41
  end
37
42
 
38
- def load_lib(gem)
39
- if gem && (RUBY_ENGINE == 'jruby' || Arel::VERSION.to_i > 9)
40
- begin
41
- Gem::Specification.find_by_name(gem)
42
- require gem
43
- rescue Gem::MissingSpecError
44
- warn "Warning: failed to load gem #{gem}. Are you sure it's installed?"
43
+ def load_lib(gems)
44
+ if gems && (RUBY_PLATFORM == 'java' || Arel::VERSION.to_i > 9)
45
+ gems.each do |gem|
46
+ begin
47
+ require gem
48
+ rescue Exception => e
49
+ warn "Warning: failed to load gem #{gem}. Are you sure it's installed?"
50
+ warn e.message
51
+ end
45
52
  end
46
53
  end
47
54
  end
data/test/real_db_test.rb CHANGED
@@ -40,6 +40,7 @@ def setup_db
40
40
  t.column :created_at, :date
41
41
  t.column :updated_at, :date
42
42
  t.column :score, :decimal
43
+ t.column :updated_at, :datetime
43
44
  end
44
45
  end
45
46
 
@@ -53,11 +54,12 @@ end
53
54
  class ListTest < Minitest::Test
54
55
  def setup
55
56
  d = Date.new(2016, 05, 23)
57
+ dt = Time.new(2016, 05, 23, 12, 34, 56)
56
58
  setup_db
57
59
  User.create age: 5, name: 'Lucas', created_at: d, score: 20.16
58
60
  User.create age: 15, name: 'Sophie', created_at: d, score: 20.16
59
61
  User.create age: 20, name: 'Camille', created_at: d, score: 20.16
60
- User.create age: 21, name: 'Arthur', created_at: d, score: 65.62
62
+ User.create age: 21, name: 'Arthur', created_at: d, score: 65.62, updated_at: dt
61
63
  u = User.create age: 23, name: 'Myung', created_at: d, score: 20.16
62
64
  @myung = User.where(id: u.id)
63
65
  User.create age: 25, name: 'Laure', created_at: d, score: 20.16
@@ -91,7 +93,7 @@ class ListTest < Minitest::Test
91
93
  end
92
94
  end
93
95
 
94
- def test_Comparator
96
+ def test_comparator
95
97
  assert_equal 2, User.where(User.arel_table[:age] < 6).count
96
98
  assert_equal 2, User.where(User.arel_table[:age] <= 10).count
97
99
  assert_equal 3, User.where(User.arel_table[:age] > 20).count
@@ -99,6 +101,18 @@ class ListTest < Minitest::Test
99
101
  assert_equal 1, User.where(User.arel_table[:age] > 5).where(User.arel_table[:age] < 20).count
100
102
  end
101
103
 
104
+ def test_date_date_comparator
105
+ d = Date.new(2016, 05, 24) #after created_at in db
106
+ assert_equal 8, User.where(User.arel_table[:age] < d).count
107
+ assert_equal 0, User.where(User.arel_table[:age] > d).count
108
+ assert_equal 0, User.where(User.arel_table[:age] == d).count
109
+ d = Date.new(2016, 05, 23)
110
+ assert_equal 8, User.where(User.arel_table[:age] == d).count
111
+ dt = Time.new(2016, 05, 23, 12, 35, 00) #after updated_at in db
112
+ assert_equal 1, User.where(User.arel_table[:update_at] < dt).count
113
+ assert_equal 0, User.where(User.arel_table[:update_at] > dt).count
114
+ end
115
+
102
116
  def test_date_duration
103
117
  # Year
104
118
  assert_equal 2016, User.where(User.arel_table[:name].eq('Lucas')).select((User.arel_table[:created_at].year).as('res')).first.res.to_i
data/version_v1.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module ArelExtensions
2
- VERSION = '1.3.9'.freeze
2
+ VERSION = '1.3.10'.freeze
3
3
  end
data/version_v2.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module ArelExtensions
2
- VERSION = '2.1.9'.freeze
2
+ VERSION = '2.1.10'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arel_extensions
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.9
4
+ version: 1.3.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yann Azoury
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2024-05-06 00:00:00.000000000 Z
13
+ date: 2024-07-31 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: arel