arel_extensions 2.0.0 → 2.0.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +7 -4
  3. data/.travis.yml +59 -91
  4. data/Gemfile +14 -19
  5. data/README.md +17 -12
  6. data/Rakefile +38 -27
  7. data/appveyor.yml +1 -1
  8. data/arel_extensions.gemspec +2 -2
  9. data/functions.html +3 -3
  10. data/gemfiles/rails4.gemfile +1 -1
  11. data/gemfiles/rails6.gemfile +30 -0
  12. data/gemspec_v2/arel_extensions-v2.gemspec +28 -0
  13. data/generate_gems.sh +14 -0
  14. data/init/mssql.sql +4 -4
  15. data/init/mysql.sql +38 -38
  16. data/init/postgresql.sql +21 -21
  17. data/lib/arel_extensions.rb +63 -19
  18. data/lib/arel_extensions/attributes.rb +0 -1
  19. data/lib/arel_extensions/boolean_functions.rb +38 -13
  20. data/lib/arel_extensions/common_sql_functions.rb +5 -4
  21. data/lib/arel_extensions/comparators.rb +4 -2
  22. data/lib/arel_extensions/insert_manager.rb +15 -13
  23. data/lib/arel_extensions/math.rb +3 -3
  24. data/lib/arel_extensions/math_functions.rb +10 -5
  25. data/lib/arel_extensions/nodes.rb +1 -1
  26. data/lib/arel_extensions/nodes/abs.rb +0 -0
  27. data/lib/arel_extensions/nodes/aggregate_function.rb +14 -0
  28. data/lib/arel_extensions/nodes/case.rb +8 -4
  29. data/lib/arel_extensions/nodes/ceil.rb +0 -0
  30. data/lib/arel_extensions/nodes/coalesce.rb +2 -2
  31. data/lib/arel_extensions/nodes/collate.rb +1 -1
  32. data/lib/arel_extensions/nodes/concat.rb +6 -13
  33. data/lib/arel_extensions/nodes/date_diff.rb +3 -5
  34. data/lib/arel_extensions/nodes/duration.rb +0 -2
  35. data/lib/arel_extensions/nodes/find_in_set.rb +0 -0
  36. data/lib/arel_extensions/nodes/floor.rb +0 -0
  37. data/lib/arel_extensions/nodes/format.rb +8 -8
  38. data/lib/arel_extensions/nodes/formatted_number.rb +23 -23
  39. data/lib/arel_extensions/nodes/function.rb +2 -0
  40. data/lib/arel_extensions/nodes/is_null.rb +0 -0
  41. data/lib/arel_extensions/nodes/json.rb +28 -30
  42. data/lib/arel_extensions/nodes/length.rb +0 -0
  43. data/lib/arel_extensions/nodes/locate.rb +0 -0
  44. data/lib/arel_extensions/nodes/matches.rb +4 -4
  45. data/lib/arel_extensions/nodes/power.rb +6 -5
  46. data/lib/arel_extensions/nodes/rand.rb +0 -0
  47. data/lib/arel_extensions/nodes/repeat.rb +2 -2
  48. data/lib/arel_extensions/nodes/replace.rb +24 -6
  49. data/lib/arel_extensions/nodes/round.rb +5 -5
  50. data/lib/arel_extensions/nodes/soundex.rb +16 -15
  51. data/lib/arel_extensions/nodes/std.rb +19 -21
  52. data/lib/arel_extensions/nodes/substring.rb +8 -15
  53. data/lib/arel_extensions/nodes/sum.rb +7 -0
  54. data/lib/arel_extensions/nodes/trim.rb +3 -3
  55. data/lib/arel_extensions/nodes/union.rb +2 -3
  56. data/lib/arel_extensions/nodes/union_all.rb +0 -1
  57. data/lib/arel_extensions/nodes/wday.rb +0 -0
  58. data/lib/arel_extensions/null_functions.rb +2 -2
  59. data/lib/arel_extensions/predications.rb +35 -33
  60. data/lib/arel_extensions/set_functions.rb +2 -2
  61. data/lib/arel_extensions/string_functions.rb +34 -12
  62. data/lib/arel_extensions/tasks.rb +5 -5
  63. data/lib/arel_extensions/version.rb +1 -1
  64. data/lib/arel_extensions/visitors.rb +1 -1
  65. data/lib/arel_extensions/visitors/ibm_db.rb +1 -1
  66. data/lib/arel_extensions/visitors/mssql.rb +14 -13
  67. data/lib/arel_extensions/visitors/mysql.rb +90 -37
  68. data/lib/arel_extensions/visitors/oracle.rb +15 -15
  69. data/lib/arel_extensions/visitors/oracle12.rb +1 -1
  70. data/lib/arel_extensions/visitors/postgresql.rb +78 -32
  71. data/lib/arel_extensions/visitors/sqlite.rb +61 -53
  72. data/lib/arel_extensions/visitors/to_sql.rb +70 -58
  73. data/test/arelx_test_helper.rb +28 -0
  74. data/test/real_db_test.rb +1 -1
  75. data/test/support/fake_record.rb +1 -1
  76. data/test/test_comparators.rb +9 -8
  77. data/test/visitors/test_bulk_insert_oracle.rb +8 -7
  78. data/test/visitors/test_bulk_insert_sqlite.rb +9 -8
  79. data/test/visitors/test_bulk_insert_to_sql.rb +8 -10
  80. data/test/visitors/test_oracle.rb +41 -40
  81. data/test/visitors/test_to_sql.rb +367 -193
  82. data/test/with_ar/all_agnostic_test.rb +68 -35
  83. data/test/with_ar/insert_agnostic_test.rb +3 -2
  84. data/test/with_ar/test_bulk_sqlite.rb +6 -5
  85. data/test/with_ar/test_math_sqlite.rb +4 -4
  86. data/test/with_ar/test_string_mysql.rb +4 -6
  87. data/test/with_ar/test_string_sqlite.rb +3 -7
  88. data/version_v1.rb +3 -0
  89. data/version_v2.rb +3 -0
  90. metadata +14 -7
  91. data/test/helper.rb +0 -18
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6a14bd89a560ffaa5eac83cdff2485533b69cf38e586662e15366bec3cb01d7c
4
- data.tar.gz: 6b6a2e8b363bdfe09f030aa78d05af37cc88b5ec9120ad745d47164202ff7164
3
+ metadata.gz: a1c901d7b1d85f0ae44bab91682891629784947bae91f7ad968c85d1e48c9948
4
+ data.tar.gz: 4b35308d0833bdc9539886dfb2575326e46551a24b03f5b98a4217000ffbb9a3
5
5
  SHA512:
6
- metadata.gz: fd37d251ec5c8bd326843860bab0a30416ea6266e692a0e2af5ce136dbae1e8e960b3ad065bc8f4bd263d82f124e372461e7e8d3c8892affee635d7a9a29a4f6
7
- data.tar.gz: 52a90ab77d60e62c81d29367e724d1ce554760077a2f8ba56985768b41ebe573b53dbff4bfe077934f23c50be0cf148e49f2a112ffda70b7f325aae8c8680157
6
+ metadata.gz: a84ef9d6cdb99b63efb35500976f10152d36cd4500307c76ffa4bc5c478502d0b517516b299b613b56a560fff96f4e23a5225944587af0cee2ae81e09b0714b5
7
+ data.tar.gz: e1c8043cb10571b353ac3a1ba14ac5ad75aa92c25fdca5d2610b8ef3413c0b0f861bd576ee6b51896ee005445af941441bfdf8c9ab698b9339e7b297f29712e2
@@ -12,7 +12,10 @@ Layout/ExtraSpacing:
12
12
  Layout/SpaceAroundEqualsInParameterDefault:
13
13
  Enabled: true
14
14
 
15
- Layout/TrailingBlankLines:
15
+ Layout/TrailingEmptyLines:
16
+ Enabled: true
17
+
18
+ Naming/FileName:
16
19
  Enabled: true
17
20
 
18
21
  Style/CollectionMethods:
@@ -33,12 +36,12 @@ Style/EmptyElse:
33
36
  Style/Encoding:
34
37
  Enabled: true
35
38
 
36
- Style/FileName:
37
- Enabled: true
38
-
39
39
  Style/MethodCallWithArgsParentheses:
40
40
  Enabled: false
41
41
 
42
+ # Performance cops have been transferred to rubocop-performance gem.
43
+ require: rubocop-performance
44
+
42
45
  Performance/DoubleStartEndWith:
43
46
  Enabled: true
44
47
 
@@ -1,5 +1,6 @@
1
1
  language: ruby
2
2
  sudo: required
3
+ dist: trusty
3
4
  cache:
4
5
  bundler: true
5
6
  directories:
@@ -15,21 +16,23 @@ before_install:
15
16
  # - sh -ex .travis/oracle/install.sh
16
17
  # - .travis/setup_accounts.sh
17
18
  install:
18
- - gem install bundler -v 1.17.3
19
19
  - bundle install
20
20
  gemfile:
21
21
  - gemfiles/rails4.gemfile
22
22
  - gemfiles/rails5_0.gemfile
23
23
  - gemfiles/rails5_1_4.gemfile
24
24
  - gemfiles/rails5_2.gemfile
25
+ - gemfiles/rails6.gemfile
25
26
  services:
26
27
  - mysql
27
28
  - postgresql
29
+ addons:
30
+ postgresql: '9.4'
28
31
  before_script:
29
32
  - mysql -e 'create database arext_test;'
30
33
  - psql -c 'create database arext_test;' -U postgres
31
34
  script:
32
- - gem build arel_extensions.gemspec
35
+ - ./generate_gems.sh
33
36
  - bundle exec rake test
34
37
  - bundle exec rake test:sqlite
35
38
  - bundle exec rake test:mysql
@@ -55,72 +58,33 @@ rvm:
55
58
  - 2.3.1
56
59
  - 2.4.0
57
60
  - 2.5.0
58
- - rbx-2
61
+ - 2.7.1
59
62
  - jruby-9.0.5.0
60
- - jruby-9.2.0.0
63
+ - jruby-9.2.11.1
61
64
  - jruby-head
62
- - ruby-head
63
65
  jdk:
64
- - openjdk7
65
66
  - oraclejdk8
66
67
  - oraclejdk9
67
68
  - openjdk10
68
- - oraclejdk10
69
69
  - openjdk11
70
70
  - oraclejdk11
71
71
  matrix:
72
72
  fast_finish: true
73
73
  exclude:
74
- - rvm: rbx-2
75
- jdk: openjdk7
76
74
  - rvm: 2.0.0
77
- jdk: openjdk7
78
- - rvm: 2.1
79
- jdk: openjdk7
80
- - rvm: 2.2.5
81
- jdk: openjdk7
82
- - rvm: 2.3.1
83
- jdk: openjdk7
84
- - rvm: 2.4.0
85
- jdk: openjdk7
86
- - rvm: 2.5.0
87
- jdk: openjdk7
88
- - rvm: ruby-head
89
- jdk: openjdk7
90
- - rvm: rbx-2
91
- jdk: oraclejdk8
92
- - rvm: 2.0.0
93
- jdk: oraclejdk8
94
- - rvm: 2.1
95
- jdk: oraclejdk8
96
- - rvm: 2.2.5
97
- jdk: oraclejdk8
98
- - rvm: 2.3.1
99
- jdk: oraclejdk8
100
- - rvm: 2.4.0
101
- jdk: oraclejdk8
102
- - rvm: 2.5.0
103
- jdk: oraclejdk8
104
- - rvm: ruby-head
105
- jdk: oraclejdk8
106
- - rvm: rbx-2
107
- jdk: oraclejdk10
108
- - rvm: 2.0.0
109
- jdk: oraclejdk10
75
+ jdk: oraclejdk9
110
76
  - rvm: 2.1
111
- jdk: oraclejdk10
77
+ jdk: oraclejdk9
112
78
  - rvm: 2.2.5
113
- jdk: oraclejdk10
79
+ jdk: oraclejdk9
114
80
  - rvm: 2.3.1
115
- jdk: oraclejdk10
81
+ jdk: oraclejdk9
116
82
  - rvm: 2.4.0
117
- jdk: oraclejdk10
83
+ jdk: oraclejdk9
118
84
  - rvm: 2.5.0
119
- jdk: oraclejdk10
120
- - rvm: ruby-head
121
- jdk: oraclejdk10
122
- - rvm: rbx-2
123
- jdk: openjdk10
85
+ jdk: oraclejdk9
86
+ - rvm: 2.7.1
87
+ jdk: oraclejdk9
124
88
  - rvm: 2.0.0
125
89
  jdk: openjdk10
126
90
  - rvm: 2.1
@@ -133,10 +97,8 @@ matrix:
133
97
  jdk: openjdk10
134
98
  - rvm: 2.5.0
135
99
  jdk: openjdk10
136
- - rvm: ruby-head
100
+ - rvm: 2.7.1
137
101
  jdk: openjdk10
138
- - rvm: rbx-2
139
- jdk: oraclejdk11
140
102
  - rvm: 2.0.0
141
103
  jdk: oraclejdk11
142
104
  - rvm: 2.1
@@ -149,10 +111,8 @@ matrix:
149
111
  jdk: oraclejdk11
150
112
  - rvm: 2.5.0
151
113
  jdk: oraclejdk11
152
- - rvm: ruby-head
153
- jdk: oraclejdk11
154
- - rvm: rbx-2
155
- jdk: openjdk11
114
+ - rvm: 2.7.1
115
+ jdk: oraclejdk11
156
116
  - rvm: 2.0.0
157
117
  jdk: openjdk11
158
118
  - rvm: 2.1
@@ -165,59 +125,67 @@ matrix:
165
125
  jdk: openjdk11
166
126
  - rvm: 2.5.0
167
127
  jdk: openjdk11
168
- - rvm: ruby-head
169
- jdk: openjdk11
170
- - rvm: jruby-9.2.0.0
171
- jdk: openjdk7
172
- - rvm: jruby-head
173
- jdk: openjdk7
128
+ - rvm: 2.7.1
129
+ jdk: openjdk11
130
+ - rvm: 2.7.1
131
+ gemfile: gemfiles/rails4.gemfile
132
+ - rvm : jruby-9.2.11.1
133
+ gemfile: gemfiles/rails4.gemfile
134
+ - rvm: 2.0.0
135
+ gemfile: gemfiles/rails5_0.gemfile
136
+ - rvm: 2.1
137
+ gemfile: gemfiles/rails5_0.gemfile
138
+ - rvm: 2.7.1
139
+ gemfile: gemfiles/rails5.0.gemfile
174
140
  - rvm: 2.0.0
175
141
  gemfile: gemfiles/rails5_1_4.gemfile
176
142
  - rvm: 2.1
177
143
  gemfile: gemfiles/rails5_1_4.gemfile
178
144
  - rvm: 2.2.5
179
145
  gemfile: gemfiles/rails5_1_4.gemfile
180
- - rvm: ruby-head
181
- gemfile: gemfiles/rails4.gemfile
182
- - rvm: 2.0.0
183
- gemfile: gemfiles/rails5_0.gemfile
184
- - rvm: 2.1
185
- gemfile: gemfiles/rails5_0.gemfile
186
- - rvm: jruby-9.0.5.0
187
- gemfile: gemfiles/rails5_1_4.gemfile
146
+ - rvm: 2.7.1
147
+ gemfile: gemfiles/rails5.1.4.gemfile
148
+ - rvm: 2.7.1
149
+ gemfile: gemfiles/rails5.1.4.gemfile
188
150
  - rvm: 2.0.0
189
151
  gemfile: gemfiles/rails5_2.gemfile
190
152
  - rvm: 2.1
191
153
  gemfile: gemfiles/rails5_2.gemfile
192
- allow_failures:
193
- - rvm: rbx-2
194
- gemfile: gemfiles/rails4.gemfile
195
- - rvm: rbx-2
196
- gemfile: gemfiles/rails5_0.gemfile
197
- - rvm: rbx-2
198
- gemfile: gemfiles/rails5_1_4.gemfile
199
- - rvm: rbx-2
154
+ - rvm: 2.2.5
200
155
  gemfile: gemfiles/rails5_2.gemfile
201
- - rvm: rbx-2
156
+ - rvm: 2.7.1
157
+ gemfile: gemfiles/rails5.2.gemfile
158
+ - rvm: 2.0.0
159
+ gemfile: gemfiles/rails6.gemfile
160
+ - rvm: 2.1
161
+ gemfile: gemfiles/rails6.gemfile
162
+ - rvm: 2.2.5
163
+ gemfile: gemfiles/rails6.gemfile
164
+ - rvm: 2.3.1
165
+ gemfile: gemfiles/rails6.gemfile
166
+ - rvm: 2.4.0
167
+ gemfile: gemfiles/rails6.gemfile
168
+ allow_failures:
169
+ - rvm: jruby-9.0.5.0
202
170
  gemfile: gemfiles/rails5_1_4.gemfile
203
- - rvm: jruby-9.0.5.0
204
- gemfile: gemfiles/rails5_2.gemfile
205
- - rvm: jruby-9.2.0.0
171
+ - rvm: jruby-9.0.5.0
172
+ gemfile: gemfiles/rails5_2.gemfile
173
+ - rvm: jruby-9.2.11.1
206
174
  jdk: oraclejdk9
207
175
  gemfile: gemfiles/rails5_2.gemfile
176
+ - jdk: oraclejdk9
208
177
  - jdk: openjdk10
209
- - jdk: oraclejdk10
210
178
  - jdk: openjdk11
211
179
  - jdk: oraclejdk11
212
- - rvm: ruby-head
213
180
  - rvm: jruby-head
214
- - rvm: jruby-9.2.0.0
181
+ - rvm: jruby-9.2.11.1
215
182
  jdk: oraclejdk9
216
183
  - rvm: jruby-9.0.5.0
217
184
  jdk: oraclejdk9
185
+ - rvm: 2.7.1
186
+ - gemfile: gemfiles/rails6.gemfile
218
187
  bundler_args: "--jobs 3 --retry 2"
219
188
  notifications:
220
- email:
221
- notifications:
222
- - julien.delporte@faveod.com
223
- - yann.azoury@faveod.com
189
+ email:
190
+ - julien.delporte@faveod.com
191
+ - yann.azoury@faveod.com
data/Gemfile CHANGED
@@ -1,29 +1,24 @@
1
1
  source "https://rubygems.org"
2
2
 
3
- gem 'rails', '~> 6.0.0.rc2'
4
-
3
+ gemspec
5
4
 
6
5
  group :development, :test do
7
- gem 'activesupport', '~> 6.0.0.rc2'
8
- gem 'activemodel', '~> 6.0.0.rc2'
9
- gem 'activerecord', '~> 6.0.0.rc2'
10
-
11
- gem "sqlite3", '~> 1.4', :platforms => [:mri, :mswin, :mingw]
12
- gem "mysql2", '0.5.2', :platforms => [:mri, :mswin, :mingw]
13
- gem "pg",'< 1.0.0', :platforms => [:mri, :mingw]
14
-
15
- gem "tiny_tds", :platforms => [:mri, :mingw] if RUBY_PLATFORM =~ /windows/
16
- gem "activerecord-sqlserver-adapter", :platforms => [:mri, :mingw]
17
-
18
- gem 'ruby-oci8', :platforms => [:mri, :mswin, :mingw] if ENV.has_key? 'ORACLE_HOME'
19
- gem 'activerecord-oracle_enhanced-adapter', '~> 6.0.0.rc2' if ENV.has_key? 'ORACLE_HOME'
6
+ gem "sqlite3", '<= 1.3.13', :platforms => [:mri, :mswin, :x64_mingw, :mingw]
7
+ gem "mysql2", '0.4.10', :platforms => [:mri, :mswin, :x64_mingw, :mingw]
8
+ gem "pg", '< 1', :platforms => [:mri, :mingw, :x64_mingw, :mswin]
20
9
 
21
- # for JRuby
22
- gem 'activerecord-jdbc-adapter', :platforms => :jruby
23
10
  gem "jdbc-sqlite3", :platforms => :jruby
24
11
  gem "activerecord-jdbcsqlite3-adapter", :platforms => :jruby
25
12
  gem "activerecord-jdbcmysql-adapter", :platforms => :jruby
26
13
  gem "activerecord-jdbcpostgresql-adapter", :platforms => :jruby
27
- gem "activerecord-jdbcmssql-adapter", :platforms => :jruby
28
- end
29
14
 
15
+ gem "tiny_tds", '~> 1.3.0' ,:require => false, :platforms => [:mri,:mingw, :x64_mingw, :mswin]
16
+ gem "activerecord-sqlserver-adapter", '~> 4.2.0', :platforms => [:mri, :mingw, :x64_mingw, :mswin]
17
+
18
+ gem 'ruby-oci8', :platforms => [:mri, :mswin, :x64_mingw, :mingw]
19
+ gem 'activerecord-oracle_enhanced-adapter', '~> 1.6.0'
20
+
21
+ gem 'activesupport', '~> 4.0'
22
+ gem 'activemodel', '~> 4.0'
23
+ gem 'activerecord', '~> 4.0'
24
+ end
data/README.md CHANGED
@@ -19,6 +19,11 @@ It allows to use more advanced SQL functions for any supported RDBMS.
19
19
  Arel 6 (Rails 4) or Arel 7+ (Rails 5).
20
20
  [Arel Repository](http://github.com/rails/arel)
21
21
 
22
+ or
23
+
24
+ Rails 6
25
+ [Rails Repository](http://github.com/rails/rails)
26
+
22
27
  ## Usage
23
28
 
24
29
  Most of the features will work just by adding the gem to your Gemfiles. To make sure to get all the features for any dbms, you should execute the next line as soon as you get your connection to your DB:
@@ -72,9 +77,9 @@ With Arel Extensions:
72
77
  Other functions : ABS, RAND, ROUND, FLOOR, CEIL, FORMAT
73
78
 
74
79
  For Example:
75
- ```ruby
80
+ ```ruby
76
81
  t[:price].format_number("%07.2f €","fr_FR")
77
- # equivalent to 'sprintf("%07.2f €",price)' plus locale management
82
+ # equivalent to 'sprintf("%07.2f €",price)' plus locale management
78
83
  ```
79
84
 
80
85
  ## String operations
@@ -130,7 +135,7 @@ t[:birthdate].format('%Y-%m-%d').to_sql
130
135
  # => DATE_FORMAT(my_table.birthdate, '%Y-%m-%d')
131
136
  ```
132
137
 
133
- ## Unions
138
+ ## Unions
134
139
 
135
140
  ```ruby
136
141
  (t.where(t[:name].eq('str')) + t.where(t[:name].eq('test'))).to_sql
@@ -143,7 +148,7 @@ Arel-extensions allows to use functions on case clause
143
148
 
144
149
  ```ruby
145
150
  t[:name].when("smith").then(1).when("doe").then(2).else(0).sum.to_sql
146
- # => SUM(CASE "my_table"."name" WHEN 'smith' THEN 1 WHEN 'doe' THEN 2 ELSE 0 END)
151
+ # => SUM(CASE "my_table"."name" WHEN 'smith' THEN 1 WHEN 'doe' THEN 2 ELSE 0 END)
147
152
  ```
148
153
 
149
154
  ## Cast Function
@@ -160,7 +165,7 @@ t[:id].cast('char').to_sql
160
165
 
161
166
  To optimize queries, some classical functions are defined in databases missing any alternative native functions.
162
167
  Examples :
163
- - FIND_IN_SET
168
+ - FIND_IN_SET
164
169
 
165
170
  ## BULK INSERT / UPSERT
166
171
 
@@ -209,7 +214,7 @@ User.connection.execute(insert_manager.to_sql)
209
214
  <td class="tg-yw4l">CEIL<br>column.ceil</td>
210
215
  <td class="ok">✔</td>
211
216
  <td class="ok">✔</td>
212
- <td class="tg-j6lv">CASE + ROUND</td>
217
+ <td class="tg-j6lv">CASE + CAST</td>
213
218
  <td class="ok">✔</td>
214
219
  <td class="tg-j6lv">CEILING()</td>
215
220
  <td class="tg-j6lv">CEILING()</td>
@@ -218,7 +223,7 @@ User.connection.execute(insert_manager.to_sql)
218
223
  <td class="tg-yw4l">FLOOR<br>column.floor</td>
219
224
  <td class="ok">✔</td>
220
225
  <td class="ok">✔</td>
221
- <td class="tg-j6lv">CASE + ROUND</td>
226
+ <td class="tg-j6lv">CASE + CAST</td>
222
227
  <td class="ok">✔</td>
223
228
  <td class="ok">✔</td>
224
229
  <td class="ok">✔</td>
@@ -385,7 +390,7 @@ User.connection.execute(insert_manager.to_sql)
385
390
  <td class="ok">✔</td>
386
391
  <td class="tg-j6lv">✔</td>
387
392
  <td class="tg-j6lv">?</td>
388
- </tr>
393
+ </tr>
389
394
  <tr>
390
395
  <td class="tg-yw4l">Matching Accent Insensitive<br>column.ai_matches('blah')</td>
391
396
  <td class="ok">not supported</td>
@@ -394,7 +399,7 @@ User.connection.execute(insert_manager.to_sql)
394
399
  <td class="ok">not supported</td>
395
400
  <td class="tg-j6lv">✔</td>
396
401
  <td class="tg-j6lv">?</td>
397
- </tr>
402
+ </tr>
398
403
  <tr>
399
404
  <td class="tg-yw4l">Matching Case Insensitive<br>column.imatches('blah')</td>
400
405
  <td class="ok">not supported</td>
@@ -403,7 +408,7 @@ User.connection.execute(insert_manager.to_sql)
403
408
  <td class="ok">✔</td>
404
409
  <td class="tg-j6lv">✔</td>
405
410
  <td class="tg-j6lv">?</td>
406
- </tr>
411
+ </tr>
407
412
  <tr>
408
413
  <td class="tg-yw4l">Matching Accent/Case Sensitive<br>column.smatches('blah')</td>
409
414
  <td class="ok">✔</td>
@@ -412,8 +417,8 @@ User.connection.execute(insert_manager.to_sql)
412
417
  <td class="ok">✔</td>
413
418
  <td class="tg-j6lv">✔</td>
414
419
  <td class="tg-j6lv">?</td>
415
- </tr>
416
-
420
+ </tr>
421
+
417
422
  <tr>
418
423
  <th class="tg-4rp9" rowspan="6"><div>Date functions</div></th>
419
424
  <td class="tg-yw4l">DATEADD<br>column + 2.year<br></td>
data/Rakefile CHANGED
@@ -7,33 +7,44 @@ desc "Default Task"
7
7
  task default: [ :test ]
8
8
 
9
9
  Rake::TestTask.new(:test) do |t|
10
- t.libs << 'lib'
11
- t.libs << 'test'
12
- t.pattern = 'test/**/test_*.rb'
13
- t.warning = true
14
- t.verbose = true
10
+ t.libs << 'lib'
11
+ t.libs << 'test'
12
+ t.pattern = 'test/**/test_*.rb'
13
+ t.warning = true
14
+ t.verbose = true
15
15
  end
16
16
 
17
- %w(mysql postgresql sqlite ibm_db oracle mssql).each do |adapter|
18
- namespace :test do
19
- Rake::TestTask.new(adapter => "#{adapter}:env") { |t|
20
- t.libs << 'lib'
21
- t.libs << 'test'
22
- t.pattern = 'test/with_ar/*_agnostic_test.rb'
23
- t.warning = true
24
- t.verbose = true
25
- t.ruby_opts = ["--dev"] if defined?(JRUBY_VERSION)
26
- }
27
- end
28
-
29
- namespace adapter do
30
- task :test => "test_#{adapter}"
31
- task :isolated_test => "isolated_test_#{adapter}"
32
-
33
- # Set the connection environment for the adapter
34
- task(:env) { ENV['DB'] = adapter }
35
- end
36
-
37
- # Make sure the adapter test evaluates the env setting task
38
- task "test_#{adapter}" => ["#{adapter}:env", "test:#{adapter}"]
17
+ namespace :test do
18
+ Rake::TestTask.new('to_sql' => []) { |t|
19
+ t.libs << 'lib'
20
+ t.libs << 'test'
21
+ t.pattern = 'test/visitors/test_to_sql.rb'
22
+ t.warning = true
23
+ t.verbose = true
24
+ t.ruby_opts = ["--dev"] if defined?(JRUBY_VERSION)
25
+ }
26
+ end
27
+
28
+ %w[mysql postgresql sqlite ibm_db oracle mssql].each do |adapter|
29
+ namespace :test do
30
+ Rake::TestTask.new(adapter => "#{adapter}:env") { |t|
31
+ t.libs << 'lib'
32
+ t.libs << 'test'
33
+ t.pattern = 'test/with_ar/*_agnostic_test.rb'
34
+ t.warning = false
35
+ t.verbose = true
36
+ t.ruby_opts = ["--dev"] if defined?(JRUBY_VERSION)
37
+ }
38
+ end
39
+
40
+ namespace adapter do
41
+ task :test => "test_#{adapter}"
42
+ task :isolated_test => "isolated_test_#{adapter}"
43
+
44
+ # Set the connection environment for the adapter
45
+ task(:env) { ENV['DB'] = adapter }
46
+ end
47
+
48
+ # Make sure the adapter test evaluates the env setting task
49
+ task "test_#{adapter}" => ["#{adapter}:env", "test:#{adapter}"]
39
50
  end