arel_extensions 2.1.2 → 2.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.codeclimate.yml +1 -2
- data/.github/workflows/ruby.yml +43 -91
- data/.gitignore +7 -6
- data/.rubocop.yml +62 -1
- data/Gemfile +11 -11
- data/README.md +1 -1
- data/Rakefile +4 -4
- data/TODO +0 -1
- data/appveyor.yml +73 -0
- data/arel_extensions.gemspec +11 -11
- data/gemfiles/rails3.gemfile +10 -10
- data/gemfiles/rails4.gemfile +14 -14
- data/gemfiles/rails5_0.gemfile +13 -13
- data/gemfiles/rails5_1_4.gemfile +13 -13
- data/gemfiles/rails5_2.gemfile +15 -14
- data/gemfiles/rails6.gemfile +13 -12
- data/gemfiles/rails6_1.gemfile +13 -12
- data/gemfiles/rails7.gemfile +9 -8
- data/gemspecs/arel_extensions-v1.gemspec +12 -12
- data/gemspecs/arel_extensions-v2.gemspec +11 -11
- data/init/mssql.sql +0 -0
- data/init/mysql.sql +0 -0
- data/init/oracle.sql +0 -0
- data/init/postgresql.sql +0 -0
- data/init/sqlite.sql +0 -0
- data/lib/arel_extensions/attributes.rb +2 -2
- data/lib/arel_extensions/boolean_functions.rb +2 -4
- data/lib/arel_extensions/common_sql_functions.rb +12 -12
- data/lib/arel_extensions/comparators.rb +14 -14
- data/lib/arel_extensions/date_duration.rb +7 -7
- data/lib/arel_extensions/helpers.rb +19 -16
- data/lib/arel_extensions/insert_manager.rb +1 -1
- data/lib/arel_extensions/math.rb +44 -31
- data/lib/arel_extensions/math_functions.rb +18 -18
- data/lib/arel_extensions/nodes/abs.rb +0 -0
- data/lib/arel_extensions/nodes/aggregate_function.rb +0 -0
- data/lib/arel_extensions/nodes/blank.rb +1 -1
- data/lib/arel_extensions/nodes/case.rb +4 -6
- data/lib/arel_extensions/nodes/cast.rb +5 -5
- data/lib/arel_extensions/nodes/ceil.rb +0 -0
- data/lib/arel_extensions/nodes/change_case.rb +0 -0
- data/lib/arel_extensions/nodes/coalesce.rb +1 -1
- data/lib/arel_extensions/nodes/collate.rb +9 -9
- data/lib/arel_extensions/nodes/concat.rb +2 -2
- data/lib/arel_extensions/nodes/date_diff.rb +10 -10
- data/lib/arel_extensions/nodes/duration.rb +0 -0
- data/lib/arel_extensions/nodes/find_in_set.rb +0 -0
- data/lib/arel_extensions/nodes/floor.rb +0 -0
- data/lib/arel_extensions/nodes/format.rb +0 -0
- data/lib/arel_extensions/nodes/formatted_number.rb +2 -2
- data/lib/arel_extensions/nodes/function.rb +21 -21
- data/lib/arel_extensions/nodes/is_null.rb +0 -0
- data/lib/arel_extensions/nodes/json.rb +7 -7
- data/lib/arel_extensions/nodes/length.rb +0 -0
- data/lib/arel_extensions/nodes/levenshtein_distance.rb +1 -1
- data/lib/arel_extensions/nodes/locate.rb +1 -1
- data/lib/arel_extensions/nodes/log10.rb +0 -0
- data/lib/arel_extensions/nodes/matches.rb +1 -1
- data/lib/arel_extensions/nodes/md5.rb +0 -0
- data/lib/arel_extensions/nodes/power.rb +0 -0
- data/lib/arel_extensions/nodes/rand.rb +0 -0
- data/lib/arel_extensions/nodes/repeat.rb +2 -2
- data/lib/arel_extensions/nodes/replace.rb +2 -2
- data/lib/arel_extensions/nodes/round.rb +0 -0
- data/lib/arel_extensions/nodes/soundex.rb +2 -2
- data/lib/arel_extensions/nodes/std.rb +0 -0
- data/lib/arel_extensions/nodes/substring.rb +1 -1
- data/lib/arel_extensions/nodes/sum.rb +0 -0
- data/lib/arel_extensions/nodes/then.rb +1 -1
- data/lib/arel_extensions/nodes/trim.rb +2 -2
- data/lib/arel_extensions/nodes/union.rb +4 -4
- data/lib/arel_extensions/nodes/union_all.rb +3 -3
- data/lib/arel_extensions/nodes/wday.rb +0 -0
- data/lib/arel_extensions/nodes.rb +0 -0
- data/lib/arel_extensions/null_functions.rb +0 -0
- data/lib/arel_extensions/predications.rb +10 -10
- data/lib/arel_extensions/railtie.rb +1 -1
- data/lib/arel_extensions/set_functions.rb +3 -3
- data/lib/arel_extensions/string_functions.rb +8 -8
- data/lib/arel_extensions/tasks.rb +2 -2
- data/lib/arel_extensions/version.rb +1 -1
- data/lib/arel_extensions/visitors/convert_format.rb +0 -0
- data/lib/arel_extensions/visitors/ibm_db.rb +20 -20
- data/lib/arel_extensions/visitors/mssql.rb +150 -130
- data/lib/arel_extensions/visitors/mysql.rb +147 -149
- data/lib/arel_extensions/visitors/oracle.rb +141 -135
- data/lib/arel_extensions/visitors/oracle12.rb +16 -16
- data/lib/arel_extensions/visitors/postgresql.rb +147 -139
- data/lib/arel_extensions/visitors/sqlite.rb +85 -87
- data/lib/arel_extensions/visitors/to_sql.rb +146 -148
- data/lib/arel_extensions/visitors.rb +7 -7
- data/lib/arel_extensions.rb +56 -32
- data/test/arelx_test_helper.rb +14 -13
- data/test/database.yml +5 -5
- data/test/real_db_test.rb +81 -81
- data/test/support/fake_record.rb +2 -2
- data/test/test_comparators.rb +5 -5
- data/test/visitors/test_bulk_insert_oracle.rb +5 -5
- data/test/visitors/test_bulk_insert_sqlite.rb +5 -5
- data/test/visitors/test_bulk_insert_to_sql.rb +5 -5
- data/test/visitors/test_oracle.rb +14 -14
- data/test/visitors/test_to_sql.rb +87 -87
- data/test/with_ar/all_agnostic_test.rb +411 -306
- data/test/with_ar/insert_agnostic_test.rb +19 -16
- data/test/with_ar/test_bulk_sqlite.rb +5 -5
- data/test/with_ar/test_math_sqlite.rb +12 -12
- data/test/with_ar/test_string_mysql.rb +20 -20
- data/test/with_ar/test_string_sqlite.rb +20 -20
- data/version_v1.rb +1 -1
- data/version_v2.rb +1 -1
- metadata +3 -9
- data/.travis/oracle/download.js +0 -152
- data/.travis/oracle/download.sh +0 -30
- data/.travis/oracle/download_ojdbc.js +0 -116
- data/.travis/oracle/install.sh +0 -34
- data/.travis/setup_accounts.sh +0 -9
- data/.travis/sqlite3/extension-functions.sh +0 -6
- data/.travis.yml +0 -193
@@ -1,7 +1,7 @@
|
|
1
1
|
module ArelExtensions
|
2
2
|
module Visitors
|
3
|
-
Arel::Visitors.send(:remove_const,'Oracle12') if Arel::Visitors.const_defined?('Oracle12')
|
4
|
-
Arel::Visitors.const_set('Oracle12',Class.new(Arel::Visitors::Oracle)).class_eval do
|
3
|
+
Arel::Visitors.send(:remove_const, 'Oracle12') if Arel::Visitors.const_defined?('Oracle12')
|
4
|
+
Arel::Visitors.const_set('Oracle12', Class.new(Arel::Visitors::Oracle)).class_eval do
|
5
5
|
|
6
6
|
def visit_Arel_Nodes_SelectOptions(o, collector)
|
7
7
|
collector = maybe_visit o.offset, collector
|
@@ -10,21 +10,21 @@ module ArelExtensions
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def visit_Arel_Nodes_Limit(o, collector)
|
13
|
-
collector <<
|
13
|
+
collector << 'FETCH FIRST '
|
14
14
|
collector = visit o.expr, collector
|
15
|
-
collector <<
|
15
|
+
collector << ' ROWS ONLY'
|
16
16
|
end
|
17
17
|
|
18
18
|
def visit_Arel_Nodes_Offset(o, collector)
|
19
|
-
collector <<
|
19
|
+
collector << 'OFFSET '
|
20
20
|
visit o.expr, collector
|
21
|
-
collector <<
|
21
|
+
collector << ' ROWS'
|
22
22
|
end
|
23
23
|
|
24
24
|
def visit_Arel_Nodes_Except(o, collector)
|
25
|
-
collector <<
|
26
|
-
collector = infix_value o, collector,
|
27
|
-
collector <<
|
25
|
+
collector << '( '
|
26
|
+
collector = infix_value o, collector, ' MINUS '
|
27
|
+
collector << ' )'
|
28
28
|
end
|
29
29
|
|
30
30
|
def visit_Arel_Nodes_UpdateStatement(o, collector)
|
@@ -43,16 +43,16 @@ module ArelExtensions
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def is_distinct_from(o, collector)
|
46
|
-
collector <<
|
46
|
+
collector << 'DECODE('
|
47
47
|
collector = visit [o.left, o.right, 0, 1], collector
|
48
|
-
collector <<
|
48
|
+
collector << ')'
|
49
49
|
end
|
50
50
|
|
51
|
-
def visit_ArelExtensions_Nodes_Json o,collector
|
51
|
+
def visit_ArelExtensions_Nodes_Json o, collector
|
52
52
|
case o.dict
|
53
53
|
when Array
|
54
54
|
collector << 'json_array('
|
55
|
-
o.dict.each.with_index do |v,i|
|
55
|
+
o.dict.each.with_index do |v, i|
|
56
56
|
if i != 0
|
57
57
|
collector << Arel::Visitors::MySQL::COMMA
|
58
58
|
end
|
@@ -61,7 +61,7 @@ module ArelExtensions
|
|
61
61
|
collector << ')'
|
62
62
|
when Hash
|
63
63
|
collector << 'json__object('
|
64
|
-
o.dict.each.with_index do |(k,v),i|
|
64
|
+
o.dict.each.with_index do |(k, v), i|
|
65
65
|
if i != 0
|
66
66
|
collector << Arel::Visitors::MySQL::COMMA
|
67
67
|
end
|
@@ -73,10 +73,10 @@ module ArelExtensions
|
|
73
73
|
end
|
74
74
|
collector << ')'
|
75
75
|
when String, Numeric, TrueClass, FalseClass
|
76
|
-
collector = visit Arel
|
76
|
+
collector = visit Arel.quoted("#{o.dict}"), collector
|
77
77
|
collector << ' FORMAT JSON'
|
78
78
|
when NilClass
|
79
|
-
collector
|
79
|
+
collector << %Q['null' FORMAT JSON]
|
80
80
|
when Arel::Attributes::Attribute
|
81
81
|
collector = visit o.dict.cast('JSON'), collector
|
82
82
|
else
|