arel 6.0.0.beta1 → 6.0.0.beta2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +9 -0
- data/.travis.yml +3 -1
- data/Gemfile +2 -9
- data/README.markdown +1 -1
- data/Rakefile +11 -16
- data/arel.gemspec +17 -33
- data/lib/arel.rb +1 -1
- data/lib/arel/nodes.rb +1 -0
- data/lib/arel/nodes/binary.rb +1 -3
- data/lib/arel/nodes/extract.rb +4 -11
- data/lib/arel/nodes/matches.rb +14 -0
- data/lib/arel/predications.rb +88 -61
- data/lib/arel/select_manager.rb +9 -0
- data/lib/arel/visitors/depth_first.rb +5 -0
- data/lib/arel/visitors/dot.rb +2 -0
- data/lib/arel/visitors/informix.rb +1 -1
- data/lib/arel/visitors/mysql.rb +1 -6
- data/lib/arel/visitors/oracle.rb +1 -1
- data/lib/arel/visitors/reduce.rb +4 -4
- data/lib/arel/visitors/to_sql.rb +35 -31
- data/lib/arel/visitors/visitor.rb +19 -12
- data/lib/arel/visitors/where_sql.rb +2 -0
- data/test/attributes/test_attribute.rb +246 -9
- data/test/nodes/test_binary.rb +26 -0
- data/test/nodes/test_extract.rb +8 -0
- data/test/test_select_manager.rb +23 -4
- data/test/visitors/test_bind_visitor.rb +0 -6
- data/test/visitors/test_depth_first.rb +8 -0
- data/test/visitors/test_informix.rb +6 -6
- data/test/visitors/test_oracle.rb +10 -0
- data/test/visitors/test_to_sql.rb +45 -19
- metadata +16 -82
- data/.autotest +0 -26
- data/.gemtest +0 -0
- data/Manifest.txt +0 -135
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 574ad2e118c98249afe11b53301402b5147f4c30
|
4
|
+
data.tar.gz: 57ffac4daf00d333d7e7f7e892a1803e000d3c92
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a60726582ea96b9c18f1ffd0dac8930b54c970c1ba31c8f21e7ab52f8bdbc2fdf88b46cd3481b208abe62f5977520680604d13df5caca1568b79b519e8896e6
|
7
|
+
data.tar.gz: 70f4af33cc151ca020f80a95520914540f51c66bad7ff2c8dc06963cacda3aa34c2208a0fe88545d4206d5b6408aa69a4ab7c6f4c7ac1a39d58416d09702402b
|
data/.gitignore
ADDED
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
@@ -1,12 +1,5 @@
|
|
1
|
-
# -*- ruby -*-
|
2
|
-
|
3
|
-
# DO NOT EDIT THIS FILE. Instead, edit Rakefile, and run `rake bundler:gemfile`.
|
4
|
-
|
5
1
|
source "https://rubygems.org/"
|
6
2
|
|
3
|
+
gemspec
|
7
4
|
|
8
|
-
gem
|
9
|
-
gem "rdoc", "~>4.0", :group => [:development, :test]
|
10
|
-
gem "hoe", "~>3.5", :group => [:development, :test]
|
11
|
-
|
12
|
-
# vim: syntax=ruby
|
5
|
+
gem 'rake'
|
data/README.markdown
CHANGED
@@ -184,7 +184,7 @@ comments_with_replies = \
|
|
184
184
|
|
185
185
|
This will return the reply for the first comment.
|
186
186
|
|
187
|
-
[Common Table
|
187
|
+
[Common Table Expressions(CTE)](https://en.wikipedia.org/wiki/Common_table_expressions#Common_table_expression) support via:
|
188
188
|
|
189
189
|
Create a `CTE`
|
190
190
|
|
data/Rakefile
CHANGED
@@ -1,20 +1,15 @@
|
|
1
|
-
require
|
2
|
-
|
3
|
-
require 'hoe'
|
1
|
+
require 'bundler'
|
2
|
+
Bundler::GemHelper.install_tasks
|
4
3
|
|
5
|
-
|
6
|
-
|
7
|
-
Hoe.plugin :gemspec # `gem install hoe-gemspec`
|
8
|
-
Hoe.plugin :git # `gem install hoe-git`
|
9
|
-
Hoe.plugin :bundler # `gem install hoe-bundler`
|
4
|
+
specname = "arel.gemspec"
|
5
|
+
deps = `git ls-files`.split("\n") - [specname]
|
10
6
|
|
11
|
-
|
12
|
-
|
13
|
-
developer('Bryan Helmkamp', 'bryan@brynary.com')
|
14
|
-
developer('Emilio Tagua', 'miloops@gmail.com')
|
15
|
-
developer('Nick Kallen', 'nick@example.org') # FIXME: need Nick's email
|
7
|
+
file specname => deps do
|
8
|
+
files = `git ls-files`.split("\n") - ["#{specname}.erb"]
|
16
9
|
|
17
|
-
|
18
|
-
|
19
|
-
|
10
|
+
require 'erb'
|
11
|
+
|
12
|
+
File.open specname, 'w:utf-8' do |f|
|
13
|
+
f.write ERB.new(File.read("#{specname}.erb")).result(binding)
|
14
|
+
end
|
20
15
|
end
|
data/arel.gemspec
CHANGED
@@ -1,40 +1,24 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
|
1
|
+
# # -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "arel"
|
3
4
|
|
4
5
|
Gem::Specification.new do |s|
|
5
|
-
s.name
|
6
|
-
s.version
|
7
|
-
|
8
|
-
s.
|
9
|
-
s.
|
10
|
-
s.
|
11
|
-
s.date = "2014-08-18"
|
6
|
+
s.name = "arel"
|
7
|
+
s.version = Arel::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Aaron Patterson", "Bryan Helmkamp", "Emilio Tagua", "Nick Kallen"]
|
10
|
+
s.email = ["aaron@tenderlovemaking.com", "bryan@brynary.com", "miloops@gmail.com"]
|
11
|
+
s.homepage = "https://github.com/rails/arel"
|
12
12
|
s.description = "Arel Really Exasperates Logicians\n\nArel is a SQL AST manager for Ruby. It\n\n1. Simplifies the generation of complex SQL queries\n2. Adapts to various RDBMSes\n\nIt is intended to be a framework framework; that is, you can build your own ORM\nwith it, focusing on innovative object and collection modeling as opposed to\ndatabase compatibility and query generation."
|
13
|
-
s.
|
14
|
-
s.
|
15
|
-
|
16
|
-
s.homepage = "http://github.com/rails/arel"
|
17
|
-
s.licenses = ["MIT"]
|
13
|
+
s.summary = "Arel Really Exasperates Logicians Arel is a SQL AST manager for Ruby"
|
14
|
+
s.license = %q{MIT}
|
15
|
+
|
18
16
|
s.rdoc_options = ["--main", "README.markdown"]
|
19
|
-
s.
|
20
|
-
s.summary = "Arel Really Exasperates Logicians Arel is a SQL AST manager for Ruby"
|
21
|
-
s.test_files = ["test/attributes/test_attribute.rb", "test/collectors/test_bind_collector.rb", "test/collectors/test_sql_string.rb", "test/nodes/test_and.rb", "test/nodes/test_as.rb", "test/nodes/test_ascending.rb", "test/nodes/test_bin.rb", "test/nodes/test_count.rb", "test/nodes/test_delete_statement.rb", "test/nodes/test_descending.rb", "test/nodes/test_distinct.rb", "test/nodes/test_equality.rb", "test/nodes/test_extract.rb", "test/nodes/test_false.rb", "test/nodes/test_grouping.rb", "test/nodes/test_infix_operation.rb", "test/nodes/test_insert_statement.rb", "test/nodes/test_named_function.rb", "test/nodes/test_node.rb", "test/nodes/test_not.rb", "test/nodes/test_or.rb", "test/nodes/test_over.rb", "test/nodes/test_select_core.rb", "test/nodes/test_select_statement.rb", "test/nodes/test_sql_literal.rb", "test/nodes/test_sum.rb", "test/nodes/test_table_alias.rb", "test/nodes/test_true.rb", "test/nodes/test_update_statement.rb", "test/nodes/test_window.rb", "test/test_attributes.rb", "test/test_crud.rb", "test/test_delete_manager.rb", "test/test_factory_methods.rb", "test/test_insert_manager.rb", "test/test_select_manager.rb", "test/test_table.rb", "test/test_update_manager.rb", "test/visitors/test_bind_visitor.rb", "test/visitors/test_depth_first.rb", "test/visitors/test_dispatch_contamination.rb", "test/visitors/test_dot.rb", "test/visitors/test_ibm_db.rb", "test/visitors/test_informix.rb", "test/visitors/test_mssql.rb", "test/visitors/test_mysql.rb", "test/visitors/test_oracle.rb", "test/visitors/test_postgres.rb", "test/visitors/test_sqlite.rb", "test/visitors/test_to_sql.rb"]
|
17
|
+
s.extra_rdoc_files = ["History.txt", "MIT-LICENSE.txt", "README.markdown"]
|
22
18
|
|
23
|
-
|
24
|
-
|
19
|
+
s.files = [".gitignore",".travis.yml","Gemfile","History.txt","MIT-LICENSE.txt","README.markdown","Rakefile","arel.gemspec","lib/arel.rb","lib/arel/alias_predication.rb","lib/arel/attributes.rb","lib/arel/attributes/attribute.rb","lib/arel/collectors/bind.rb","lib/arel/collectors/plain_string.rb","lib/arel/collectors/sql_string.rb","lib/arel/compatibility/wheres.rb","lib/arel/crud.rb","lib/arel/delete_manager.rb","lib/arel/expressions.rb","lib/arel/factory_methods.rb","lib/arel/insert_manager.rb","lib/arel/math.rb","lib/arel/nodes.rb","lib/arel/nodes/and.rb","lib/arel/nodes/ascending.rb","lib/arel/nodes/binary.rb","lib/arel/nodes/count.rb","lib/arel/nodes/delete_statement.rb","lib/arel/nodes/descending.rb","lib/arel/nodes/equality.rb","lib/arel/nodes/extract.rb","lib/arel/nodes/false.rb","lib/arel/nodes/full_outer_join.rb","lib/arel/nodes/function.rb","lib/arel/nodes/grouping.rb","lib/arel/nodes/in.rb","lib/arel/nodes/infix_operation.rb","lib/arel/nodes/inner_join.rb","lib/arel/nodes/insert_statement.rb","lib/arel/nodes/join_source.rb","lib/arel/nodes/matches.rb","lib/arel/nodes/named_function.rb","lib/arel/nodes/node.rb","lib/arel/nodes/outer_join.rb","lib/arel/nodes/over.rb","lib/arel/nodes/right_outer_join.rb","lib/arel/nodes/select_core.rb","lib/arel/nodes/select_statement.rb","lib/arel/nodes/sql_literal.rb","lib/arel/nodes/string_join.rb","lib/arel/nodes/table_alias.rb","lib/arel/nodes/terminal.rb","lib/arel/nodes/true.rb","lib/arel/nodes/unary.rb","lib/arel/nodes/unqualified_column.rb","lib/arel/nodes/update_statement.rb","lib/arel/nodes/values.rb","lib/arel/nodes/window.rb","lib/arel/nodes/with.rb","lib/arel/order_predications.rb","lib/arel/predications.rb","lib/arel/select_manager.rb","lib/arel/table.rb","lib/arel/tree_manager.rb","lib/arel/update_manager.rb","lib/arel/visitors.rb","lib/arel/visitors/bind_substitute.rb","lib/arel/visitors/bind_visitor.rb","lib/arel/visitors/depth_first.rb","lib/arel/visitors/dot.rb","lib/arel/visitors/ibm_db.rb","lib/arel/visitors/informix.rb","lib/arel/visitors/mssql.rb","lib/arel/visitors/mysql.rb","lib/arel/visitors/oracle.rb","lib/arel/visitors/postgresql.rb","lib/arel/visitors/reduce.rb","lib/arel/visitors/sqlite.rb","lib/arel/visitors/to_sql.rb","lib/arel/visitors/visitor.rb","lib/arel/visitors/where_sql.rb","lib/arel/window_predications.rb","test/attributes/test_attribute.rb","test/collectors/test_bind_collector.rb","test/collectors/test_sql_string.rb","test/helper.rb","test/nodes/test_and.rb","test/nodes/test_as.rb","test/nodes/test_ascending.rb","test/nodes/test_bin.rb","test/nodes/test_binary.rb","test/nodes/test_count.rb","test/nodes/test_delete_statement.rb","test/nodes/test_descending.rb","test/nodes/test_distinct.rb","test/nodes/test_equality.rb","test/nodes/test_extract.rb","test/nodes/test_false.rb","test/nodes/test_grouping.rb","test/nodes/test_infix_operation.rb","test/nodes/test_insert_statement.rb","test/nodes/test_named_function.rb","test/nodes/test_node.rb","test/nodes/test_not.rb","test/nodes/test_or.rb","test/nodes/test_over.rb","test/nodes/test_select_core.rb","test/nodes/test_select_statement.rb","test/nodes/test_sql_literal.rb","test/nodes/test_sum.rb","test/nodes/test_table_alias.rb","test/nodes/test_true.rb","test/nodes/test_update_statement.rb","test/nodes/test_window.rb","test/support/fake_record.rb","test/test_attributes.rb","test/test_crud.rb","test/test_delete_manager.rb","test/test_factory_methods.rb","test/test_insert_manager.rb","test/test_select_manager.rb","test/test_table.rb","test/test_update_manager.rb","test/visitors/test_bind_visitor.rb","test/visitors/test_depth_first.rb","test/visitors/test_dispatch_contamination.rb","test/visitors/test_dot.rb","test/visitors/test_ibm_db.rb","test/visitors/test_informix.rb","test/visitors/test_mssql.rb","test/visitors/test_mysql.rb","test/visitors/test_oracle.rb","test/visitors/test_postgres.rb","test/visitors/test_sqlite.rb","test/visitors/test_to_sql.rb"]
|
20
|
+
s.require_paths = ["lib"]
|
25
21
|
|
26
|
-
|
27
|
-
|
28
|
-
s.add_development_dependency(%q<rdoc>, ["~> 4.0"])
|
29
|
-
s.add_development_dependency(%q<hoe>, ["~> 3.12"])
|
30
|
-
else
|
31
|
-
s.add_dependency(%q<minitest>, ["~> 5.4"])
|
32
|
-
s.add_dependency(%q<rdoc>, ["~> 4.0"])
|
33
|
-
s.add_dependency(%q<hoe>, ["~> 3.12"])
|
34
|
-
end
|
35
|
-
else
|
36
|
-
s.add_dependency(%q<minitest>, ["~> 5.4"])
|
37
|
-
s.add_dependency(%q<rdoc>, ["~> 4.0"])
|
38
|
-
s.add_dependency(%q<hoe>, ["~> 3.12"])
|
39
|
-
end
|
22
|
+
s.add_development_dependency('minitest', '~> 5.4')
|
23
|
+
s.add_development_dependency('rdoc', '~> 4.0')
|
40
24
|
end
|
data/lib/arel.rb
CHANGED
data/lib/arel/nodes.rb
CHANGED
data/lib/arel/nodes/binary.rb
CHANGED
@@ -16,7 +16,7 @@ module Arel
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def hash
|
19
|
-
[@left, @right].hash
|
19
|
+
[self.class, @left, @right].hash
|
20
20
|
end
|
21
21
|
|
22
22
|
def eql? other
|
@@ -31,13 +31,11 @@ module Arel
|
|
31
31
|
As
|
32
32
|
Assignment
|
33
33
|
Between
|
34
|
-
DoesNotMatch
|
35
34
|
GreaterThan
|
36
35
|
GreaterThanOrEqual
|
37
36
|
Join
|
38
37
|
LessThan
|
39
38
|
LessThanOrEqual
|
40
|
-
Matches
|
41
39
|
NotEqual
|
42
40
|
NotIn
|
43
41
|
NotRegexp
|
data/lib/arel/nodes/extract.rb
CHANGED
@@ -1,30 +1,23 @@
|
|
1
1
|
module Arel
|
2
2
|
module Nodes
|
3
3
|
class Extract < Arel::Nodes::Unary
|
4
|
+
include Arel::AliasPredication
|
4
5
|
include Arel::Predications
|
5
6
|
|
6
7
|
attr_accessor :field
|
7
|
-
attr_accessor :alias
|
8
8
|
|
9
|
-
def initialize expr, field
|
9
|
+
def initialize expr, field
|
10
10
|
super(expr)
|
11
11
|
@field = field
|
12
|
-
@alias = aliaz && SqlLiteral.new(aliaz)
|
13
|
-
end
|
14
|
-
|
15
|
-
def as aliaz
|
16
|
-
self.alias = SqlLiteral.new(aliaz)
|
17
|
-
self
|
18
12
|
end
|
19
13
|
|
20
14
|
def hash
|
21
|
-
super ^
|
15
|
+
super ^ @field.hash
|
22
16
|
end
|
23
17
|
|
24
18
|
def eql? other
|
25
19
|
super &&
|
26
|
-
self.field == other.field
|
27
|
-
self.alias == other.alias
|
20
|
+
self.field == other.field
|
28
21
|
end
|
29
22
|
alias :== :eql?
|
30
23
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Arel
|
2
|
+
module Nodes
|
3
|
+
class Matches < Binary
|
4
|
+
attr_reader :escape
|
5
|
+
|
6
|
+
def initialize(left, right, escape = nil)
|
7
|
+
super(left, right)
|
8
|
+
@escape = escape && Nodes.build_quoted(escape)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
class DoesNotMatch < Matches; end
|
13
|
+
end
|
14
|
+
end
|
data/lib/arel/predications.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Arel
|
2
2
|
module Predications
|
3
3
|
def not_eq other
|
4
|
-
Nodes::NotEqual.new self,
|
4
|
+
Nodes::NotEqual.new self, quoted_node(other)
|
5
5
|
end
|
6
6
|
|
7
7
|
def not_eq_any others
|
@@ -13,7 +13,7 @@ module Arel
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def eq other
|
16
|
-
Nodes::Equality.new self,
|
16
|
+
Nodes::Equality.new self, quoted_node(other)
|
17
17
|
end
|
18
18
|
|
19
19
|
def eq_any others
|
@@ -21,7 +21,27 @@ module Arel
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def eq_all others
|
24
|
-
grouping_all :eq, others
|
24
|
+
grouping_all :eq, quoted_array(others)
|
25
|
+
end
|
26
|
+
|
27
|
+
def between other
|
28
|
+
if other.begin == -Float::INFINITY
|
29
|
+
if other.end == Float::INFINITY
|
30
|
+
not_in([])
|
31
|
+
elsif other.exclude_end?
|
32
|
+
lt(other.end)
|
33
|
+
else
|
34
|
+
lteq(other.end)
|
35
|
+
end
|
36
|
+
elsif other.end == Float::INFINITY
|
37
|
+
gteq(other.begin)
|
38
|
+
elsif other.exclude_end?
|
39
|
+
gteq(other.begin).and(lt(other.end))
|
40
|
+
else
|
41
|
+
left = quoted_node(other.begin)
|
42
|
+
right = quoted_node(other.end)
|
43
|
+
Nodes::Between.new(self, left.and(right))
|
44
|
+
end
|
25
45
|
end
|
26
46
|
|
27
47
|
def in other
|
@@ -29,27 +49,16 @@ module Arel
|
|
29
49
|
when Arel::SelectManager
|
30
50
|
Arel::Nodes::In.new(self, other.ast)
|
31
51
|
when Range
|
32
|
-
if
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
Nodes::LessThan.new(self, Nodes.build_quoted(other.end, self))
|
37
|
-
else
|
38
|
-
Nodes::LessThanOrEqual.new(self, Nodes.build_quoted(other.end, self))
|
39
|
-
end
|
40
|
-
elsif other.end == Float::INFINITY
|
41
|
-
Nodes::GreaterThanOrEqual.new(self, Nodes.build_quoted(other.begin, self))
|
42
|
-
elsif other.exclude_end?
|
43
|
-
left = Nodes::GreaterThanOrEqual.new(self, Nodes.build_quoted(other.begin, self))
|
44
|
-
right = Nodes::LessThan.new(self, Nodes.build_quoted(other.end, self))
|
45
|
-
Nodes::And.new [left, right]
|
46
|
-
else
|
47
|
-
Nodes::Between.new(self, Nodes::And.new([Nodes.build_quoted(other.begin, self), Nodes.build_quoted(other.end, self)]))
|
52
|
+
if $VERBOSE
|
53
|
+
warn <<-eowarn
|
54
|
+
Passing a range to `#in` is deprecated. Call `#between`, instead.
|
55
|
+
eowarn
|
48
56
|
end
|
57
|
+
between(other)
|
49
58
|
when Array
|
50
|
-
Nodes::In.new self, other
|
59
|
+
Nodes::In.new self, quoted_array(other)
|
51
60
|
else
|
52
|
-
Nodes::In.new self,
|
61
|
+
Nodes::In.new self, quoted_node(other)
|
53
62
|
end
|
54
63
|
end
|
55
64
|
|
@@ -61,34 +70,43 @@ module Arel
|
|
61
70
|
grouping_all :in, others
|
62
71
|
end
|
63
72
|
|
73
|
+
def not_between other
|
74
|
+
if other.begin == -Float::INFINITY # The range begins with negative infinity
|
75
|
+
if other.end == Float::INFINITY
|
76
|
+
self.in([])
|
77
|
+
elsif other.exclude_end?
|
78
|
+
gteq(other.end)
|
79
|
+
else
|
80
|
+
gt(other.end)
|
81
|
+
end
|
82
|
+
elsif other.end == Float::INFINITY
|
83
|
+
lt(other.begin)
|
84
|
+
else
|
85
|
+
left = lt(other.begin)
|
86
|
+
right = if other.exclude_end?
|
87
|
+
gteq(other.end)
|
88
|
+
else
|
89
|
+
gt(other.end)
|
90
|
+
end
|
91
|
+
left.or(right)
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
64
95
|
def not_in other
|
65
96
|
case other
|
66
97
|
when Arel::SelectManager
|
67
98
|
Arel::Nodes::NotIn.new(self, other.ast)
|
68
99
|
when Range
|
69
|
-
if
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
Nodes::GreaterThanOrEqual.new(self, Nodes.build_quoted(other.end, self))
|
74
|
-
else
|
75
|
-
Nodes::GreaterThan.new(self, Nodes.build_quoted(other.end, self))
|
76
|
-
end
|
77
|
-
elsif other.end == Float::INFINITY
|
78
|
-
Nodes::LessThan.new(self, Nodes.build_quoted(other.begin, self))
|
79
|
-
else
|
80
|
-
left = Nodes::LessThan.new(self, Nodes.build_quoted(other.begin, self))
|
81
|
-
if other.exclude_end?
|
82
|
-
right = Nodes::GreaterThanOrEqual.new(self, Nodes.build_quoted(other.end, self))
|
83
|
-
else
|
84
|
-
right = Nodes::GreaterThan.new(self, Nodes.build_quoted(other.end, self))
|
85
|
-
end
|
86
|
-
Nodes::Or.new left, right
|
100
|
+
if $VERBOSE
|
101
|
+
warn <<-eowarn
|
102
|
+
Passing a range to `#not_in` is deprecated. Call `#not_between`, instead.
|
103
|
+
eowarn
|
87
104
|
end
|
105
|
+
not_between(other)
|
88
106
|
when Array
|
89
|
-
Nodes::NotIn.new self, other
|
107
|
+
Nodes::NotIn.new self, quoted_array(other)
|
90
108
|
else
|
91
|
-
Nodes::NotIn.new self,
|
109
|
+
Nodes::NotIn.new self, quoted_node(other)
|
92
110
|
end
|
93
111
|
end
|
94
112
|
|
@@ -100,32 +118,32 @@ module Arel
|
|
100
118
|
grouping_all :not_in, others
|
101
119
|
end
|
102
120
|
|
103
|
-
def matches other
|
104
|
-
Nodes::Matches.new self,
|
121
|
+
def matches other, escape = nil
|
122
|
+
Nodes::Matches.new self, quoted_node(other), escape
|
105
123
|
end
|
106
124
|
|
107
|
-
def matches_any others
|
108
|
-
grouping_any :matches, others
|
125
|
+
def matches_any others, escape = nil
|
126
|
+
grouping_any :matches, others, escape
|
109
127
|
end
|
110
128
|
|
111
|
-
def matches_all others
|
112
|
-
grouping_all :matches, others
|
129
|
+
def matches_all others, escape = nil
|
130
|
+
grouping_all :matches, others, escape
|
113
131
|
end
|
114
132
|
|
115
|
-
def does_not_match other
|
116
|
-
Nodes::DoesNotMatch.new self,
|
133
|
+
def does_not_match other, escape = nil
|
134
|
+
Nodes::DoesNotMatch.new self, quoted_node(other), escape
|
117
135
|
end
|
118
136
|
|
119
|
-
def does_not_match_any others
|
120
|
-
grouping_any :does_not_match, others
|
137
|
+
def does_not_match_any others, escape = nil
|
138
|
+
grouping_any :does_not_match, others, escape
|
121
139
|
end
|
122
140
|
|
123
|
-
def does_not_match_all others
|
124
|
-
grouping_all :does_not_match, others
|
141
|
+
def does_not_match_all others, escape = nil
|
142
|
+
grouping_all :does_not_match, others, escape
|
125
143
|
end
|
126
144
|
|
127
145
|
def gteq right
|
128
|
-
Nodes::GreaterThanOrEqual.new self,
|
146
|
+
Nodes::GreaterThanOrEqual.new self, quoted_node(right)
|
129
147
|
end
|
130
148
|
|
131
149
|
def gteq_any others
|
@@ -137,7 +155,7 @@ module Arel
|
|
137
155
|
end
|
138
156
|
|
139
157
|
def gt right
|
140
|
-
Nodes::GreaterThan.new self,
|
158
|
+
Nodes::GreaterThan.new self, quoted_node(right)
|
141
159
|
end
|
142
160
|
|
143
161
|
def gt_any others
|
@@ -149,7 +167,7 @@ module Arel
|
|
149
167
|
end
|
150
168
|
|
151
169
|
def lt right
|
152
|
-
Nodes::LessThan.new self, right
|
170
|
+
Nodes::LessThan.new self, quoted_node(right)
|
153
171
|
end
|
154
172
|
|
155
173
|
def lt_any others
|
@@ -161,7 +179,7 @@ module Arel
|
|
161
179
|
end
|
162
180
|
|
163
181
|
def lteq right
|
164
|
-
Nodes::LessThanOrEqual.new self, right
|
182
|
+
Nodes::LessThanOrEqual.new self, quoted_node(right)
|
165
183
|
end
|
166
184
|
|
167
185
|
def lteq_any others
|
@@ -174,15 +192,24 @@ module Arel
|
|
174
192
|
|
175
193
|
private
|
176
194
|
|
177
|
-
def grouping_any method_id, others
|
178
|
-
nodes = others.map {|expr| send(method_id, expr)}
|
195
|
+
def grouping_any method_id, others, *extras
|
196
|
+
nodes = others.map {|expr| send(method_id, expr, *extras)}
|
179
197
|
Nodes::Grouping.new nodes.inject { |memo,node|
|
180
198
|
Nodes::Or.new(memo, node)
|
181
199
|
}
|
182
200
|
end
|
183
201
|
|
184
|
-
def grouping_all method_id, others
|
185
|
-
|
202
|
+
def grouping_all method_id, others, *extras
|
203
|
+
nodes = others.map {|expr| send(method_id, expr, *extras)}
|
204
|
+
Nodes::Grouping.new Nodes::And.new(nodes)
|
205
|
+
end
|
206
|
+
|
207
|
+
def quoted_node(other)
|
208
|
+
Nodes.build_quoted(other, self)
|
209
|
+
end
|
210
|
+
|
211
|
+
def quoted_array(others)
|
212
|
+
others.map { |v| quoted_node(v) }
|
186
213
|
end
|
187
214
|
end
|
188
215
|
end
|