arel_extensions 1.4.2 → 2.0.0.rc3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.codeclimate.yml +2 -1
- data/.gitignore +6 -7
- data/.rubocop.yml +3 -67
- data/.travis/oracle/download.js +152 -0
- data/.travis/oracle/download.sh +30 -0
- data/.travis/oracle/download_ojdbc.js +116 -0
- data/.travis/oracle/install.sh +34 -0
- data/.travis/setup_accounts.sh +9 -0
- data/.travis/sqlite3/extension-functions.sh +6 -0
- data/.travis.yml +223 -0
- data/Gemfile +28 -2
- data/README.md +90 -239
- data/Rakefile +30 -48
- data/TODO +1 -0
- data/appveyor.yml +22 -60
- data/arel_extensions.gemspec +14 -13
- data/functions.html +3 -3
- data/gemfiles/rails3.gemfile +10 -10
- data/gemfiles/rails4.gemfile +29 -0
- data/gemfiles/rails5_0.gemfile +29 -0
- data/gemfiles/rails5_1_4.gemfile +14 -14
- data/gemfiles/rails5_2.gemfile +14 -16
- data/init/mssql.sql +4 -4
- data/init/mysql.sql +38 -38
- data/init/oracle.sql +0 -0
- data/init/postgresql.sql +21 -21
- data/init/sqlite.sql +0 -0
- data/lib/arel_extensions/attributes.rb +3 -10
- data/lib/arel_extensions/boolean_functions.rb +14 -53
- data/lib/arel_extensions/common_sql_functions.rb +17 -16
- data/lib/arel_extensions/comparators.rb +28 -27
- data/lib/arel_extensions/date_duration.rb +13 -17
- data/lib/arel_extensions/insert_manager.rb +15 -18
- data/lib/arel_extensions/math.rb +53 -55
- data/lib/arel_extensions/math_functions.rb +39 -46
- data/lib/arel_extensions/nodes/abs.rb +1 -0
- data/lib/arel_extensions/nodes/blank.rb +2 -1
- data/lib/arel_extensions/nodes/case.rb +19 -20
- data/lib/arel_extensions/nodes/cast.rb +8 -10
- data/lib/arel_extensions/nodes/ceil.rb +1 -1
- data/lib/arel_extensions/nodes/coalesce.rb +4 -3
- data/lib/arel_extensions/nodes/collate.rb +10 -9
- data/lib/arel_extensions/nodes/concat.rb +18 -9
- data/lib/arel_extensions/nodes/date_diff.rb +26 -42
- data/lib/arel_extensions/nodes/duration.rb +3 -0
- data/lib/arel_extensions/nodes/find_in_set.rb +1 -0
- data/lib/arel_extensions/nodes/floor.rb +1 -1
- data/lib/arel_extensions/nodes/format.rb +8 -35
- data/lib/arel_extensions/nodes/formatted_number.rb +23 -22
- data/lib/arel_extensions/nodes/function.rb +37 -42
- data/lib/arel_extensions/nodes/is_null.rb +0 -0
- data/lib/arel_extensions/nodes/json.rb +39 -52
- data/lib/arel_extensions/nodes/length.rb +0 -5
- data/lib/arel_extensions/nodes/levenshtein_distance.rb +1 -1
- data/lib/arel_extensions/nodes/locate.rb +2 -1
- data/lib/arel_extensions/nodes/log10.rb +2 -1
- data/lib/arel_extensions/nodes/matches.rb +7 -5
- data/lib/arel_extensions/nodes/md5.rb +1 -0
- data/lib/arel_extensions/nodes/power.rb +5 -5
- data/lib/arel_extensions/nodes/rand.rb +1 -0
- data/lib/arel_extensions/nodes/repeat.rb +5 -3
- data/lib/arel_extensions/nodes/replace.rb +8 -16
- data/lib/arel_extensions/nodes/round.rb +6 -5
- data/lib/arel_extensions/nodes/soundex.rb +15 -15
- data/lib/arel_extensions/nodes/std.rb +21 -18
- data/lib/arel_extensions/nodes/substring.rb +16 -8
- data/lib/arel_extensions/nodes/then.rb +1 -1
- data/lib/arel_extensions/nodes/trim.rb +6 -4
- data/lib/arel_extensions/nodes/union.rb +8 -5
- data/lib/arel_extensions/nodes/union_all.rb +7 -4
- data/lib/arel_extensions/nodes/wday.rb +4 -0
- data/lib/arel_extensions/nodes.rb +1 -1
- data/lib/arel_extensions/null_functions.rb +5 -19
- data/lib/arel_extensions/predications.rb +43 -44
- data/lib/arel_extensions/railtie.rb +5 -5
- data/lib/arel_extensions/set_functions.rb +7 -5
- data/lib/arel_extensions/string_functions.rb +29 -59
- data/lib/arel_extensions/tasks.rb +6 -6
- data/lib/arel_extensions/version.rb +1 -1
- data/lib/arel_extensions/visitors/ibm_db.rb +31 -24
- data/lib/arel_extensions/visitors/mssql.rb +191 -422
- data/lib/arel_extensions/visitors/mysql.rb +212 -350
- data/lib/arel_extensions/visitors/oracle.rb +178 -220
- data/lib/arel_extensions/visitors/oracle12.rb +31 -18
- data/lib/arel_extensions/visitors/postgresql.rb +173 -256
- data/lib/arel_extensions/visitors/sqlite.rb +126 -140
- data/lib/arel_extensions/visitors/to_sql.rb +237 -298
- data/lib/arel_extensions/visitors.rb +62 -83
- data/lib/arel_extensions.rb +31 -224
- data/test/database.yml +7 -15
- data/test/helper.rb +18 -0
- data/test/real_db_test.rb +117 -120
- data/test/support/fake_record.rb +3 -9
- data/test/test_comparators.rb +17 -14
- data/test/visitors/test_bulk_insert_oracle.rb +11 -11
- data/test/visitors/test_bulk_insert_sqlite.rb +13 -12
- data/test/visitors/test_bulk_insert_to_sql.rb +13 -11
- data/test/visitors/test_oracle.rb +55 -55
- data/test/visitors/test_to_sql.rb +226 -419
- data/test/with_ar/all_agnostic_test.rb +366 -711
- data/test/with_ar/insert_agnostic_test.rb +21 -27
- data/test/with_ar/test_bulk_sqlite.rb +16 -17
- data/test/with_ar/test_math_sqlite.rb +26 -26
- data/test/with_ar/test_string_mysql.rb +33 -31
- data/test/with_ar/test_string_sqlite.rb +34 -30
- metadata +34 -43
- data/.github/workflows/publish.yml +0 -29
- data/.github/workflows/release.yml +0 -30
- data/.github/workflows/ruby.yml +0 -399
- data/CONTRIBUTING.md +0 -102
- data/NEWS.md +0 -89
- data/bin/build +0 -15
- data/bin/compose +0 -6
- data/bin/publish +0 -8
- data/dev/arelx.dockerfile +0 -44
- data/dev/compose.yaml +0 -71
- data/dev/postgres.dockerfile +0 -5
- data/dev/rbenv +0 -189
- data/gemfiles/rails4_2.gemfile +0 -38
- data/gemfiles/rails5.gemfile +0 -29
- data/gemfiles/rails6.gemfile +0 -33
- data/gemfiles/rails6_1.gemfile +0 -33
- data/gemfiles/rails7.gemfile +0 -33
- data/gemfiles/rails7_1.gemfile +0 -33
- data/gemfiles/rails7_2.gemfile +0 -33
- data/gemspecs/arel_extensions-v1.gemspec +0 -27
- data/gemspecs/arel_extensions-v2.gemspec +0 -27
- data/generate_gems.sh +0 -15
- data/lib/arel_extensions/aliases.rb +0 -14
- data/lib/arel_extensions/helpers.rb +0 -62
- data/lib/arel_extensions/nodes/aggregate_function.rb +0 -13
- data/lib/arel_extensions/nodes/formatted_date.rb +0 -42
- data/lib/arel_extensions/nodes/rollup.rb +0 -36
- data/lib/arel_extensions/nodes/select.rb +0 -10
- data/lib/arel_extensions/nodes/sum.rb +0 -7
- data/lib/arel_extensions/visitors/convert_format.rb +0 -37
- data/test/arelx_test_helper.rb +0 -74
- data/version_v1.rb +0 -3
- data/version_v2.rb +0 -3
data/.travis.yml
ADDED
@@ -0,0 +1,223 @@
|
|
1
|
+
language: ruby
|
2
|
+
sudo: required
|
3
|
+
cache:
|
4
|
+
bundler: true
|
5
|
+
directories:
|
6
|
+
- $ORACLE_HOME
|
7
|
+
before_install:
|
8
|
+
- chmod +x .travis/sqlite3/extension-functions.sh
|
9
|
+
# - chmod +x .travis/oracle/download.sh
|
10
|
+
# - chmod +x .travis/oracle/install.sh
|
11
|
+
# - chmod +x .travis/setup_accounts.sh
|
12
|
+
- sudo apt-get install -y sqlite3-pcre curl
|
13
|
+
- .travis/sqlite3/extension-functions.sh
|
14
|
+
# - .travis/oracle/download.sh
|
15
|
+
# - sh -ex .travis/oracle/install.sh
|
16
|
+
# - .travis/setup_accounts.sh
|
17
|
+
install:
|
18
|
+
- gem install bundler -v 1.17.3
|
19
|
+
- bundle install
|
20
|
+
gemfile:
|
21
|
+
- gemfiles/rails4.gemfile
|
22
|
+
- gemfiles/rails5_0.gemfile
|
23
|
+
- gemfiles/rails5_1_4.gemfile
|
24
|
+
- gemfiles/rails5_2.gemfile
|
25
|
+
services:
|
26
|
+
- mysql
|
27
|
+
- postgresql
|
28
|
+
before_script:
|
29
|
+
- mysql -e 'create database arext_test;'
|
30
|
+
- psql -c 'create database arext_test;' -U postgres
|
31
|
+
script:
|
32
|
+
- gem build arel_extensions.gemspec
|
33
|
+
- bundle exec rake test
|
34
|
+
- bundle exec rake test:sqlite
|
35
|
+
- bundle exec rake test:mysql
|
36
|
+
- bundle exec rake test:postgresql
|
37
|
+
#- bundle exec rake test:oracle # service unavailable
|
38
|
+
env:
|
39
|
+
global:
|
40
|
+
- JRUBY_OPTS='--dev -J-Xmx1024M'
|
41
|
+
# - ORACLE_COOKIE=sqldev
|
42
|
+
# - ORACLE_FILE=oracle11g/xe/oracle-xe-11.2.0-1.0.x86_64.rpm.zip
|
43
|
+
# - ORACLE_OJDBC_URL=http://download.oracle.com/otn/utilities_drivers/jdbc/11204/ojdbc6.jar
|
44
|
+
- TNS_ADMIN=$ORACLE_HOME/network/admin
|
45
|
+
# - ORACLE_BASE=/u01/app/oracle
|
46
|
+
# - ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe
|
47
|
+
# - ORACLE_SID=XE
|
48
|
+
- DATABASE_NAME=XE
|
49
|
+
- NLS_LANG=AMERICAN_AMERICA.AL32UTF8
|
50
|
+
- secure: 0RUuF4l0e3J8UIIMlgb8x/aYy2pH6Wb+EWylOr2W1EQechivoFw6IEYD1EZWIOZ/uNpkQ2h/urbUqW3/HpKhZn+NYP2sQI41Xyu1TD+6HPWAHpEvLzemhQSJV6eIeLRQoVDLUmqF23nUZDtKQAwOOyJVMeqHMahJi5K7N/cfQmifs2QcBnMxPnANIcrSXxOCBoqCl6BERG9JTeKERG/lWG1I9vRIe9ISNyOPUQVVI6SfTJwhJP5NLkxSJG1q2PLPK7p6zQ684sS4zSnS5oV23yDsQWWIwxk78CVu1jnFBu8Qq3ngWsInlkHrPotjtaxmTxM8JQd4fgE5NMO2Pjnj8w7zg+sbl+3OVtareX+M9+OLdUD5xBQhecPpzflMqib2qZ0fr9tdoT8kAZJTiXtQrptZfaXleZlH74l2dO/PYxkoWMusYQnSbQl0G3AoyYH+l7YpefL4arm0s5IIiOK+ZiCoZ14pl26rYAA1iPUe5AT+hecKi+fwqhyFE7fMX+zC+AvzsQL8jrP0CXL/hmPkoFYxvcDgUoYhvOq+mmQHdOfU7ny4hH5z5d9691qceduHFvF7fNZ4pSofj03eGqfTTk+SDNeZIo6NXNlayayjV2L/DxL6d7vetxkWwipx47PI76gBAqJlxgODJuzoOtyQkPyIVsDlzI1UPoS+UbrU51w=
|
51
|
+
rvm:
|
52
|
+
- 2.0.0
|
53
|
+
- 2.1
|
54
|
+
- 2.2.5
|
55
|
+
- 2.3.1
|
56
|
+
- 2.4.0
|
57
|
+
- 2.5.0
|
58
|
+
- rbx-2
|
59
|
+
- jruby-9.0.5.0
|
60
|
+
- jruby-9.2.0.0
|
61
|
+
- jruby-head
|
62
|
+
- ruby-head
|
63
|
+
jdk:
|
64
|
+
- openjdk7
|
65
|
+
- oraclejdk8
|
66
|
+
- oraclejdk9
|
67
|
+
- openjdk10
|
68
|
+
- oraclejdk10
|
69
|
+
- openjdk11
|
70
|
+
- oraclejdk11
|
71
|
+
matrix:
|
72
|
+
fast_finish: true
|
73
|
+
exclude:
|
74
|
+
- rvm: rbx-2
|
75
|
+
jdk: openjdk7
|
76
|
+
- 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
|
110
|
+
- rvm: 2.1
|
111
|
+
jdk: oraclejdk10
|
112
|
+
- rvm: 2.2.5
|
113
|
+
jdk: oraclejdk10
|
114
|
+
- rvm: 2.3.1
|
115
|
+
jdk: oraclejdk10
|
116
|
+
- rvm: 2.4.0
|
117
|
+
jdk: oraclejdk10
|
118
|
+
- rvm: 2.5.0
|
119
|
+
jdk: oraclejdk10
|
120
|
+
- rvm: ruby-head
|
121
|
+
jdk: oraclejdk10
|
122
|
+
- rvm: rbx-2
|
123
|
+
jdk: openjdk10
|
124
|
+
- rvm: 2.0.0
|
125
|
+
jdk: openjdk10
|
126
|
+
- rvm: 2.1
|
127
|
+
jdk: openjdk10
|
128
|
+
- rvm: 2.2.5
|
129
|
+
jdk: openjdk10
|
130
|
+
- rvm: 2.3.1
|
131
|
+
jdk: openjdk10
|
132
|
+
- rvm: 2.4.0
|
133
|
+
jdk: openjdk10
|
134
|
+
- rvm: 2.5.0
|
135
|
+
jdk: openjdk10
|
136
|
+
- rvm: ruby-head
|
137
|
+
jdk: openjdk10
|
138
|
+
- rvm: rbx-2
|
139
|
+
jdk: oraclejdk11
|
140
|
+
- rvm: 2.0.0
|
141
|
+
jdk: oraclejdk11
|
142
|
+
- rvm: 2.1
|
143
|
+
jdk: oraclejdk11
|
144
|
+
- rvm: 2.2.5
|
145
|
+
jdk: oraclejdk11
|
146
|
+
- rvm: 2.3.1
|
147
|
+
jdk: oraclejdk11
|
148
|
+
- rvm: 2.4.0
|
149
|
+
jdk: oraclejdk11
|
150
|
+
- rvm: 2.5.0
|
151
|
+
jdk: oraclejdk11
|
152
|
+
- rvm: ruby-head
|
153
|
+
jdk: oraclejdk11
|
154
|
+
- rvm: rbx-2
|
155
|
+
jdk: openjdk11
|
156
|
+
- rvm: 2.0.0
|
157
|
+
jdk: openjdk11
|
158
|
+
- rvm: 2.1
|
159
|
+
jdk: openjdk11
|
160
|
+
- rvm: 2.2.5
|
161
|
+
jdk: openjdk11
|
162
|
+
- rvm: 2.3.1
|
163
|
+
jdk: openjdk11
|
164
|
+
- rvm: 2.4.0
|
165
|
+
jdk: openjdk11
|
166
|
+
- rvm: 2.5.0
|
167
|
+
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
|
174
|
+
- rvm: 2.0.0
|
175
|
+
gemfile: gemfiles/rails5_1_4.gemfile
|
176
|
+
- rvm: 2.1
|
177
|
+
gemfile: gemfiles/rails5_1_4.gemfile
|
178
|
+
- rvm: 2.2.5
|
179
|
+
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
|
188
|
+
- rvm: 2.0.0
|
189
|
+
gemfile: gemfiles/rails5_2.gemfile
|
190
|
+
- rvm: 2.1
|
191
|
+
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
|
200
|
+
gemfile: gemfiles/rails5_2.gemfile
|
201
|
+
- rvm: rbx-2
|
202
|
+
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
|
206
|
+
jdk: oraclejdk9
|
207
|
+
gemfile: gemfiles/rails5_2.gemfile
|
208
|
+
- jdk: openjdk10
|
209
|
+
- jdk: oraclejdk10
|
210
|
+
- jdk: openjdk11
|
211
|
+
- jdk: oraclejdk11
|
212
|
+
- rvm: ruby-head
|
213
|
+
- rvm: jruby-head
|
214
|
+
- rvm: jruby-9.2.0.0
|
215
|
+
jdk: oraclejdk9
|
216
|
+
- rvm: jruby-9.0.5.0
|
217
|
+
jdk: oraclejdk9
|
218
|
+
bundler_args: "--jobs 3 --retry 2"
|
219
|
+
notifications:
|
220
|
+
email:
|
221
|
+
notifications:
|
222
|
+
- julien.delporte@faveod.com
|
223
|
+
- yann.azoury@faveod.com
|
data/Gemfile
CHANGED
@@ -1,3 +1,29 @@
|
|
1
|
-
source
|
1
|
+
source "https://rubygems.org"
|
2
|
+
|
3
|
+
gem 'rails', '~> 6.0.0.rc2'
|
4
|
+
|
5
|
+
|
6
|
+
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'
|
20
|
+
|
21
|
+
# for JRuby
|
22
|
+
gem 'activerecord-jdbc-adapter', :platforms => :jruby
|
23
|
+
gem "jdbc-sqlite3", :platforms => :jruby
|
24
|
+
gem "activerecord-jdbcsqlite3-adapter", :platforms => :jruby
|
25
|
+
gem "activerecord-jdbcmysql-adapter", :platforms => :jruby
|
26
|
+
gem "activerecord-jdbcpostgresql-adapter", :platforms => :jruby
|
27
|
+
gem "activerecord-jdbcmssql-adapter", :platforms => :jruby
|
28
|
+
end
|
2
29
|
|
3
|
-
gemspec path: Dir.pwd
|