arel_extensions 1.2.3 → 1.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +10 -10
- data/Gemfile +2 -2
- data/README.md +10 -10
- data/appveyor.yml +1 -1
- data/functions.html +1 -1
- data/init/mssql.sql +4 -4
- data/init/mysql.sql +38 -38
- data/init/postgresql.sql +21 -21
- data/lib/arel_extensions.rb +17 -1
- data/lib/arel_extensions/common_sql_functions.rb +1 -1
- data/lib/arel_extensions/comparators.rb +4 -2
- data/lib/arel_extensions/math_functions.rb +9 -4
- data/lib/arel_extensions/nodes.rb +1 -1
- data/lib/arel_extensions/nodes/aggregate_function.rb +14 -0
- data/lib/arel_extensions/nodes/coalesce.rb +2 -2
- data/lib/arel_extensions/nodes/concat.rb +6 -13
- data/lib/arel_extensions/nodes/date_diff.rb +2 -2
- data/lib/arel_extensions/nodes/format.rb +8 -8
- data/lib/arel_extensions/nodes/formatted_number.rb +6 -6
- data/lib/arel_extensions/nodes/function.rb +2 -0
- data/lib/arel_extensions/nodes/matches.rb +4 -4
- data/lib/arel_extensions/nodes/power.rb +2 -2
- data/lib/arel_extensions/nodes/repeat.rb +2 -2
- data/lib/arel_extensions/nodes/replace.rb +1 -1
- data/lib/arel_extensions/nodes/soundex.rb +4 -4
- data/lib/arel_extensions/nodes/std.rb +19 -21
- data/lib/arel_extensions/nodes/substring.rb +1 -1
- data/lib/arel_extensions/nodes/sum.rb +7 -0
- data/lib/arel_extensions/nodes/trim.rb +2 -2
- data/lib/arel_extensions/nodes/union.rb +2 -2
- data/lib/arel_extensions/null_functions.rb +2 -2
- data/lib/arel_extensions/string_functions.rb +10 -7
- data/lib/arel_extensions/version.rb +1 -1
- data/lib/arel_extensions/visitors/mssql.rb +4 -4
- data/lib/arel_extensions/visitors/mysql.rb +28 -4
- data/lib/arel_extensions/visitors/oracle.rb +4 -4
- data/lib/arel_extensions/visitors/postgresql.rb +34 -6
- data/lib/arel_extensions/visitors/to_sql.rb +29 -22
- data/test/helper.rb +1 -1
- data/test/real_db_test.rb +1 -1
- data/test/test_comparators.rb +1 -1
- data/test/visitors/test_bulk_insert_sqlite.rb +1 -1
- data/test/visitors/test_bulk_insert_to_sql.rb +7 -9
- data/test/visitors/test_oracle.rb +1 -0
- data/test/visitors/test_to_sql.rb +6 -0
- data/test/with_ar/all_agnostic_test.rb +14 -3
- data/test/with_ar/insert_agnostic_test.rb +2 -1
- data/test/with_ar/test_bulk_sqlite.rb +1 -1
- data/test/with_ar/test_math_sqlite.rb +2 -2
- data/test/with_ar/test_string_mysql.rb +3 -3
- data/test/with_ar/test_string_sqlite.rb +2 -2
- metadata +5 -4
@@ -23,7 +23,7 @@ module ArelExtensions
|
|
23
23
|
@cnx.execute(sql) rescue $stderr << "can't create functions\n"
|
24
24
|
end
|
25
25
|
end
|
26
|
-
@cnx.drop_table(:user_tests) rescue nil
|
26
|
+
@cnx.drop_table(:user_tests) rescue nil
|
27
27
|
@cnx.create_table :user_tests do |t|
|
28
28
|
t.column :age, :integer
|
29
29
|
t.column :name, :string
|
@@ -77,6 +77,7 @@ END;])
|
|
77
77
|
insert_manager.bulk_insert(@cols2, @data2)
|
78
78
|
@cnx.execute(insert_manager.to_sql)
|
79
79
|
assert_equal 4, User.count, "insertions failed"
|
80
|
+
|
80
81
|
end
|
81
82
|
|
82
83
|
end
|
@@ -12,7 +12,7 @@ module ArelExtensions
|
|
12
12
|
@cnx = ActiveRecord::Base.connection
|
13
13
|
Arel::Table.engine = ActiveRecord::Base
|
14
14
|
@cnx.drop_table(:users) rescue nil
|
15
|
-
@cnx.drop_table(:products) rescue nil
|
15
|
+
@cnx.drop_table(:products) rescue nil
|
16
16
|
@cnx.create_table :users do |t|
|
17
17
|
t.column :age, :integer
|
18
18
|
t.column :name, :string
|
@@ -11,8 +11,8 @@ module ArelExtensions
|
|
11
11
|
ActiveRecord::Base.default_timezone = :utc
|
12
12
|
Arel::Table.engine = ActiveRecord::Base
|
13
13
|
@cnx = ActiveRecord::Base.connection
|
14
|
-
@cnx.drop_table(:users) rescue nil
|
15
|
-
@cnx.drop_table(:products) rescue nil
|
14
|
+
@cnx.drop_table(:users) rescue nil
|
15
|
+
@cnx.drop_table(:products) rescue nil
|
16
16
|
@cnx.create_table :users do |t|
|
17
17
|
t.column :age, :integer
|
18
18
|
t.column :name, :string
|
@@ -10,7 +10,7 @@ module ArelExtensions
|
|
10
10
|
ActiveRecord::Base.configurations = YAML.load_file('test/database.yml')
|
11
11
|
ActiveRecord::Base.establish_connection(ENV['DB'] || (RUBY_PLATFORM == 'java' ? :"jdbc-mysql" : :mysql))
|
12
12
|
ActiveRecord::Base.default_timezone = :utc
|
13
|
-
begin
|
13
|
+
begin
|
14
14
|
@cnx = ActiveRecord::Base.connection
|
15
15
|
rescue => e
|
16
16
|
puts "\n#{e.inspect}"
|
@@ -19,7 +19,7 @@ module ArelExtensions
|
|
19
19
|
end
|
20
20
|
Arel::Table.engine = ActiveRecord::Base
|
21
21
|
@cnx.drop_table(:users) rescue nil
|
22
|
-
@cnx.drop_table(:products) rescue nil
|
22
|
+
@cnx.drop_table(:products) rescue nil
|
23
23
|
@cnx.create_table :users do |t|
|
24
24
|
t.column :age, :integer
|
25
25
|
t.column :name, :string
|
@@ -68,7 +68,7 @@ module ArelExtensions
|
|
68
68
|
assert_equal "LucaX", User.where(:id => @lucas).select(@name.replace("s","X").as("res")).first.res
|
69
69
|
assert_equal "replace", User.where(:id => @lucas).select(@name.replace(@name,"replace").as("res")).first.res
|
70
70
|
|
71
|
-
#
|
71
|
+
#
|
72
72
|
end
|
73
73
|
|
74
74
|
end
|
@@ -12,7 +12,7 @@ module ArelExtensions
|
|
12
12
|
ActiveRecord::Base.default_timezone = :utc
|
13
13
|
@cnx = ActiveRecord::Base.connection
|
14
14
|
Arel::Table.engine = ActiveRecord::Base
|
15
|
-
@cnx.drop_table(:users) rescue nil
|
15
|
+
@cnx.drop_table(:users) rescue nil
|
16
16
|
@cnx.create_table :users do |t|
|
17
17
|
t.column :age, :integer
|
18
18
|
t.column :name, :string
|
@@ -63,7 +63,7 @@ module ArelExtensions
|
|
63
63
|
assert_equal "LucaX", User.where(:id => @lucas).select(@name.replace("s","X").as("res")).first.res
|
64
64
|
assert_equal "replace", User.where(:id => @lucas).select(@name.replace(@name,"replace").as("res")).first.res
|
65
65
|
|
66
|
-
#
|
66
|
+
#
|
67
67
|
end
|
68
68
|
|
69
69
|
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.2.
|
4
|
+
version: 1.2.5
|
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: 2019-
|
13
|
+
date: 2019-11-06 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: arel
|
@@ -120,6 +120,7 @@ files:
|
|
120
120
|
- lib/arel_extensions/math_functions.rb
|
121
121
|
- lib/arel_extensions/nodes.rb
|
122
122
|
- lib/arel_extensions/nodes/abs.rb
|
123
|
+
- lib/arel_extensions/nodes/aggregate_function.rb
|
123
124
|
- lib/arel_extensions/nodes/blank.rb
|
124
125
|
- lib/arel_extensions/nodes/case.rb
|
125
126
|
- lib/arel_extensions/nodes/cast.rb
|
@@ -151,6 +152,7 @@ files:
|
|
151
152
|
- lib/arel_extensions/nodes/soundex.rb
|
152
153
|
- lib/arel_extensions/nodes/std.rb
|
153
154
|
- lib/arel_extensions/nodes/substring.rb
|
155
|
+
- lib/arel_extensions/nodes/sum.rb
|
154
156
|
- lib/arel_extensions/nodes/then.rb
|
155
157
|
- lib/arel_extensions/nodes/trim.rb
|
156
158
|
- lib/arel_extensions/nodes/union.rb
|
@@ -211,8 +213,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
211
213
|
- !ruby/object:Gem::Version
|
212
214
|
version: '0'
|
213
215
|
requirements: []
|
214
|
-
|
215
|
-
rubygems_version: 2.5.2.3
|
216
|
+
rubygems_version: 3.0.2
|
216
217
|
signing_key:
|
217
218
|
specification_version: 4
|
218
219
|
summary: Extending Arel
|