arel 3.0.3 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.travis.yml +2 -4
- data/Gemfile +2 -2
- data/History.txt +3 -54
- data/Manifest.txt +8 -2
- data/README.markdown +8 -4
- data/Rakefile +1 -1
- data/arel.gemspec +21 -29
- data/lib/arel/crud.rb +3 -3
- data/lib/arel/nodes/and.rb +10 -0
- data/lib/arel/nodes/binary.rb +11 -0
- data/lib/arel/nodes/extract.rb +11 -0
- data/lib/arel/nodes/false.rb +7 -0
- data/lib/arel/nodes/function.rb +11 -0
- data/lib/arel/nodes/grouping.rb +7 -0
- data/lib/arel/nodes/insert_statement.rb +12 -0
- data/lib/arel/nodes/named_function.rb +9 -0
- data/lib/arel/nodes/select_core.rb +20 -0
- data/lib/arel/nodes/select_statement.rb +15 -1
- data/lib/arel/nodes/table_alias.rb +4 -0
- data/lib/arel/nodes/terminal.rb +7 -0
- data/lib/arel/nodes/true.rb +7 -0
- data/lib/arel/nodes/unary.rb +10 -1
- data/lib/arel/nodes/update_statement.rb +15 -0
- data/lib/arel/nodes/window.rb +30 -3
- data/lib/arel/nodes.rb +1 -0
- data/lib/arel/predications.rb +18 -2
- data/lib/arel/select_manager.rb +6 -2
- data/lib/arel/table.rb +14 -1
- data/lib/arel/tree_manager.rb +0 -2
- data/lib/arel/visitors/bind_visitor.rb +10 -0
- data/lib/arel/visitors/dot.rb +2 -2
- data/lib/arel/visitors/to_sql.rb +142 -31
- data/lib/arel.rb +1 -3
- data/test/nodes/test_and.rb +20 -0
- data/test/nodes/test_as.rb +12 -0
- data/test/nodes/test_ascending.rb +10 -0
- data/test/nodes/test_bin.rb +10 -0
- data/test/nodes/test_count.rb +12 -0
- data/test/nodes/test_delete_statement.rb +20 -0
- data/test/nodes/test_descending.rb +10 -0
- data/test/nodes/test_distinct.rb +20 -0
- data/test/nodes/test_equality.rb +10 -0
- data/test/nodes/test_extract.rb +14 -0
- data/test/nodes/test_false.rb +20 -0
- data/test/nodes/test_grouping.rb +25 -0
- data/test/nodes/test_infix_operation.rb +10 -0
- data/test/nodes/test_insert_statement.rb +24 -0
- data/test/nodes/test_named_function.rb +16 -0
- data/test/nodes/test_not.rb +12 -0
- data/test/nodes/test_or.rb +12 -0
- data/test/nodes/test_over.rb +18 -0
- data/test/nodes/test_select_core.rb +38 -0
- data/test/nodes/test_select_statement.rb +36 -0
- data/test/nodes/test_sql_literal.rb +10 -0
- data/test/nodes/test_sum.rb +12 -0
- data/test/nodes/test_table_alias.rb +36 -0
- data/test/nodes/test_true.rb +21 -0
- data/test/nodes/test_update_statement.rb +40 -0
- data/test/nodes/test_window.rb +73 -0
- data/test/support/fake_record.rb +5 -1
- data/test/test_attributes.rb +12 -0
- data/test/test_insert_manager.rb +0 -2
- data/test/test_select_manager.rb +10 -5
- data/test/test_table.rb +24 -0
- data/test/test_update_manager.rb +8 -0
- data/test/visitors/test_bind_visitor.rb +20 -1
- data/test/visitors/test_to_sql.rb +78 -0
- metadata +84 -82
- data/lib/arel/nodes/ordering.rb +0 -6
- data/lib/arel/relation.rb +0 -6
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
source "https://rubygems.org/"
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
gem "minitest", "~>4.
|
|
8
|
+
gem "minitest", "~>4.4", :group => [:development, :test]
|
|
9
9
|
gem "rdoc", "~>4.0", :group => [:development, :test]
|
|
10
|
-
gem "hoe", "~>3.
|
|
10
|
+
gem "hoe", "~>3.5", :group => [:development, :test]
|
|
11
11
|
|
|
12
12
|
# vim: syntax=ruby
|
data/History.txt
CHANGED
|
@@ -1,54 +1,3 @@
|
|
|
1
|
-
== 3.0.3 / 2013-11-12
|
|
2
|
-
|
|
3
|
-
* Enhancements
|
|
4
|
-
|
|
5
|
-
* Support ANSI 2003 window functions
|
|
6
|
-
|
|
7
|
-
* Bug Fixes
|
|
8
|
-
|
|
9
|
-
* Fix joins in Informix
|
|
10
|
-
|
|
11
|
-
== 3.0.2 / 2012-02-21
|
|
12
|
-
|
|
13
|
-
* Enhancements
|
|
14
|
-
|
|
15
|
-
* Added a module for visiting and transforming bind values
|
|
16
|
-
* Fix in [] to be false, not in [] to be true
|
|
17
|
-
|
|
18
|
-
* Bug Fixes
|
|
19
|
-
|
|
20
|
-
* Revert fix for LIMIT / OFFSET when query is ordered in Oracle
|
|
21
|
-
|
|
22
|
-
== 3.0.1 / 2012-02-17
|
|
23
|
-
|
|
24
|
-
* Bug Fixes
|
|
25
|
-
|
|
26
|
-
* Fixed LIMIT / OFFSET when query is ordered in Oracle
|
|
27
|
-
|
|
28
|
-
== 3.0.0 / 2012-01-12
|
|
29
|
-
|
|
30
|
-
* Enhancements
|
|
31
|
-
|
|
32
|
-
* Support connection pool and schema cache
|
|
33
|
-
|
|
34
|
-
* Bug Fixes
|
|
35
|
-
|
|
36
|
-
* Conditions with no column can be followed by other conditions in Postgres
|
|
37
|
-
|
|
38
|
-
== 2.2.3 / 2012-02-21
|
|
39
|
-
|
|
40
|
-
* Enhancements
|
|
41
|
-
|
|
42
|
-
* Added a module for visiting and transforming bind values
|
|
43
|
-
|
|
44
|
-
== 2.2.2 / 2012-02-20
|
|
45
|
-
|
|
46
|
-
* Enhancements
|
|
47
|
-
|
|
48
|
-
* Support LOCK
|
|
49
|
-
* Allow using non-table alias as a right-hand relation name
|
|
50
|
-
* Added SelectManager#distinct
|
|
51
|
-
|
|
52
1
|
== 2.2.1 / 2011-09-15
|
|
53
2
|
|
|
54
3
|
* Enhancements
|
|
@@ -195,7 +144,7 @@
|
|
|
195
144
|
|
|
196
145
|
* Deprecations
|
|
197
146
|
|
|
198
|
-
* Support for Subclasses of core classes will be removed in
|
|
147
|
+
* Support for Subclasses of core classes will be removed in Arel version
|
|
199
148
|
2.2.0
|
|
200
149
|
|
|
201
150
|
== 2.0.4
|
|
@@ -235,7 +184,7 @@
|
|
|
235
184
|
|
|
236
185
|
* Introduced "SQL compilers" for query generation.
|
|
237
186
|
* Added support for Oracle (Raimonds Simanovskis) and IBM/DB (Praveen Devarao).
|
|
238
|
-
* Improvements to give better support to
|
|
187
|
+
* Improvements to give better support to Active Record.
|
|
239
188
|
|
|
240
189
|
== 0.2.1 / 2010-02-05
|
|
241
190
|
|
|
@@ -246,7 +195,7 @@
|
|
|
246
195
|
== 0.2.0 / 2010-01-31
|
|
247
196
|
|
|
248
197
|
* Ruby 1.9 compatibility
|
|
249
|
-
* Many improvements to support the Arel integration into
|
|
198
|
+
* Many improvements to support the Arel integration into Active Record (see `git log v0.1.0..v0.2.0`)
|
|
250
199
|
* Thanks to Emilio Tagua and Pratik Naik for many significant contributions!
|
|
251
200
|
|
|
252
201
|
== 0.1.0 / 2009-08-06
|
data/Manifest.txt
CHANGED
|
@@ -32,6 +32,7 @@ lib/arel/nodes/equality.rb
|
|
|
32
32
|
lib/arel/nodes/extract.rb
|
|
33
33
|
lib/arel/nodes/false.rb
|
|
34
34
|
lib/arel/nodes/function.rb
|
|
35
|
+
lib/arel/nodes/grouping.rb
|
|
35
36
|
lib/arel/nodes/in.rb
|
|
36
37
|
lib/arel/nodes/infix_operation.rb
|
|
37
38
|
lib/arel/nodes/inner_join.rb
|
|
@@ -39,7 +40,6 @@ lib/arel/nodes/insert_statement.rb
|
|
|
39
40
|
lib/arel/nodes/join_source.rb
|
|
40
41
|
lib/arel/nodes/named_function.rb
|
|
41
42
|
lib/arel/nodes/node.rb
|
|
42
|
-
lib/arel/nodes/ordering.rb
|
|
43
43
|
lib/arel/nodes/outer_join.rb
|
|
44
44
|
lib/arel/nodes/over.rb
|
|
45
45
|
lib/arel/nodes/select_core.rb
|
|
@@ -57,7 +57,6 @@ lib/arel/nodes/window.rb
|
|
|
57
57
|
lib/arel/nodes/with.rb
|
|
58
58
|
lib/arel/order_predications.rb
|
|
59
59
|
lib/arel/predications.rb
|
|
60
|
-
lib/arel/relation.rb
|
|
61
60
|
lib/arel/select_manager.rb
|
|
62
61
|
lib/arel/sql/engine.rb
|
|
63
62
|
lib/arel/sql_literal.rb
|
|
@@ -83,14 +82,18 @@ lib/arel/visitors/where_sql.rb
|
|
|
83
82
|
lib/arel/window_predications.rb
|
|
84
83
|
test/attributes/test_attribute.rb
|
|
85
84
|
test/helper.rb
|
|
85
|
+
test/nodes/test_and.rb
|
|
86
86
|
test/nodes/test_as.rb
|
|
87
87
|
test/nodes/test_ascending.rb
|
|
88
88
|
test/nodes/test_bin.rb
|
|
89
89
|
test/nodes/test_count.rb
|
|
90
90
|
test/nodes/test_delete_statement.rb
|
|
91
91
|
test/nodes/test_descending.rb
|
|
92
|
+
test/nodes/test_distinct.rb
|
|
92
93
|
test/nodes/test_equality.rb
|
|
93
94
|
test/nodes/test_extract.rb
|
|
95
|
+
test/nodes/test_false.rb
|
|
96
|
+
test/nodes/test_grouping.rb
|
|
94
97
|
test/nodes/test_infix_operation.rb
|
|
95
98
|
test/nodes/test_insert_statement.rb
|
|
96
99
|
test/nodes/test_named_function.rb
|
|
@@ -102,7 +105,10 @@ test/nodes/test_select_core.rb
|
|
|
102
105
|
test/nodes/test_select_statement.rb
|
|
103
106
|
test/nodes/test_sql_literal.rb
|
|
104
107
|
test/nodes/test_sum.rb
|
|
108
|
+
test/nodes/test_table_alias.rb
|
|
109
|
+
test/nodes/test_true.rb
|
|
105
110
|
test/nodes/test_update_statement.rb
|
|
111
|
+
test/nodes/test_window.rb
|
|
106
112
|
test/support/fake_record.rb
|
|
107
113
|
test/test_activerecord_compat.rb
|
|
108
114
|
test/test_attributes.rb
|
data/README.markdown
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Arel [](http://travis-ci.org/rails/arel) [](https://gemnasium.com/rails/arel)
|
|
2
2
|
|
|
3
3
|
* http://github.com/rails/arel
|
|
4
4
|
|
|
@@ -15,11 +15,11 @@ database compatibility and query generation.
|
|
|
15
15
|
|
|
16
16
|
## Status
|
|
17
17
|
|
|
18
|
-
For the moment, Arel uses
|
|
18
|
+
For the moment, Arel uses Active Record's connection adapters to connect to the various engines, connection pooling, perform quoting, and do type conversion.
|
|
19
19
|
|
|
20
20
|
## A Gentle Introduction
|
|
21
21
|
|
|
22
|
-
Generating a query with
|
|
22
|
+
Generating a query with Arel is simple. For example, in order to produce
|
|
23
23
|
|
|
24
24
|
SELECT * FROM users
|
|
25
25
|
|
|
@@ -54,7 +54,7 @@ What are called `LIMIT` and `OFFSET` in SQL are called `take` and `skip` in Arel
|
|
|
54
54
|
|
|
55
55
|
`GROUP BY` is called `group`:
|
|
56
56
|
|
|
57
|
-
users.group(users[:name]) # => SELECT
|
|
57
|
+
users.project(users[:name]).group(users[:name]) # => SELECT users.name FROM users GROUP BY users.name
|
|
58
58
|
|
|
59
59
|
The best property of the Relational Algebra is its "composability", or closure under all operations. For example, to restrict AND project, just "chain" the method invocations:
|
|
60
60
|
|
|
@@ -116,3 +116,7 @@ The `parent_id` column is a foreign key from the `comments` table to itself. Now
|
|
|
116
116
|
# => SELECT * FROM comments INNER JOIN comments AS comments_2 WHERE comments_2.parent_id = comments.id
|
|
117
117
|
|
|
118
118
|
This will return the first comment's reply's body.
|
|
119
|
+
|
|
120
|
+
### License
|
|
121
|
+
|
|
122
|
+
Arel is released under the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
CHANGED
data/arel.gemspec
CHANGED
|
@@ -1,47 +1,39 @@
|
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
|
2
2
|
|
|
3
3
|
Gem::Specification.new do |s|
|
|
4
|
-
s.name =
|
|
5
|
-
s.version = "
|
|
4
|
+
s.name = "arel"
|
|
5
|
+
s.version = "4.0.0.20130418133826"
|
|
6
6
|
|
|
7
|
-
s.required_rubygems_version = Gem::Requirement.new("
|
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
|
|
8
8
|
s.authors = ["Aaron Patterson", "Bryan Halmkamp", "Emilio Tagua", "Nick Kallen"]
|
|
9
|
-
s.date =
|
|
10
|
-
s.description =
|
|
11
|
-
|
|
12
|
-
1. Simplifies the generation of complex SQL queries
|
|
13
|
-
2. Adapts to various RDBMS systems
|
|
14
|
-
|
|
15
|
-
It is intended to be a framework framework; that is, you can build your own ORM
|
|
16
|
-
with it, focusing on innovative object and collection modeling as opposed to
|
|
17
|
-
database compatibility and query generation.}
|
|
9
|
+
s.date = "2013-04-18"
|
|
10
|
+
s.description = "Arel is a SQL AST manager for Ruby. It\n\n1. Simplifies the generation of complex SQL queries\n2. Adapts to various RDBMS systems\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."
|
|
18
11
|
s.email = ["aaron@tenderlovemaking.com", "bryan@brynary.com", "miloops@gmail.com", "nick@example.org"]
|
|
19
12
|
s.extra_rdoc_files = ["History.txt", "MIT-LICENSE.txt", "Manifest.txt", "README.markdown"]
|
|
20
|
-
s.files = [".autotest", ".gemtest", ".travis.yml", "Gemfile", "History.txt", "MIT-LICENSE.txt", "Manifest.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/compatibility/wheres.rb", "lib/arel/crud.rb", "lib/arel/delete_manager.rb", "lib/arel/deprecated.rb", "lib/arel/expression.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/function.rb", "lib/arel/nodes/
|
|
21
|
-
s.homepage =
|
|
22
|
-
s.licenses = ["MIT"]
|
|
13
|
+
s.files = [".autotest", ".gemtest", ".travis.yml", "Gemfile", "History.txt", "MIT-LICENSE.txt", "Manifest.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/compatibility/wheres.rb", "lib/arel/crud.rb", "lib/arel/delete_manager.rb", "lib/arel/deprecated.rb", "lib/arel/expression.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/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/named_function.rb", "lib/arel/nodes/node.rb", "lib/arel/nodes/outer_join.rb", "lib/arel/nodes/over.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/sql/engine.rb", "lib/arel/sql_literal.rb", "lib/arel/table.rb", "lib/arel/tree_manager.rb", "lib/arel/update_manager.rb", "lib/arel/visitors.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/join_sql.rb", "lib/arel/visitors/mssql.rb", "lib/arel/visitors/mysql.rb", "lib/arel/visitors/oracle.rb", "lib/arel/visitors/order_clauses.rb", "lib/arel/visitors/postgresql.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/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_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_activerecord_compat.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_dot.rb", "test/visitors/test_ibm_db.rb", "test/visitors/test_informix.rb", "test/visitors/test_join_sql.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"]
|
|
14
|
+
s.homepage = "http://github.com/rails/arel"
|
|
23
15
|
s.rdoc_options = ["--main", "README.markdown"]
|
|
24
16
|
s.require_paths = ["lib"]
|
|
25
|
-
s.rubyforge_project =
|
|
26
|
-
s.rubygems_version =
|
|
27
|
-
s.summary =
|
|
28
|
-
s.test_files = ["test/attributes/test_attribute.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_equality.rb", "test/nodes/test_extract.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_update_statement.rb", "test/test_activerecord_compat.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_dot.rb", "test/visitors/test_ibm_db.rb", "test/visitors/test_informix.rb", "test/visitors/test_join_sql.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.rubyforge_project = "arel"
|
|
18
|
+
s.rubygems_version = "2.0.2"
|
|
19
|
+
s.summary = "Arel is a SQL AST manager for Ruby"
|
|
20
|
+
s.test_files = ["test/attributes/test_attribute.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_activerecord_compat.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_dot.rb", "test/visitors/test_ibm_db.rb", "test/visitors/test_informix.rb", "test/visitors/test_join_sql.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"]
|
|
29
21
|
|
|
30
22
|
if s.respond_to? :specification_version then
|
|
31
|
-
s.specification_version =
|
|
23
|
+
s.specification_version = 4
|
|
32
24
|
|
|
33
25
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
|
34
|
-
s.add_development_dependency(%q<minitest>, ["~> 4.
|
|
35
|
-
s.add_development_dependency(%q<rdoc>, ["~>
|
|
36
|
-
s.add_development_dependency(%q<hoe>, ["~> 3.
|
|
26
|
+
s.add_development_dependency(%q<minitest>, ["~> 4.6"])
|
|
27
|
+
s.add_development_dependency(%q<rdoc>, ["~> 3.10"])
|
|
28
|
+
s.add_development_dependency(%q<hoe>, ["~> 3.5"])
|
|
37
29
|
else
|
|
38
|
-
s.add_dependency(%q<minitest>, ["~> 4.
|
|
39
|
-
s.add_dependency(%q<rdoc>, ["~>
|
|
40
|
-
s.add_dependency(%q<hoe>, ["~> 3.
|
|
30
|
+
s.add_dependency(%q<minitest>, ["~> 4.6"])
|
|
31
|
+
s.add_dependency(%q<rdoc>, ["~> 3.10"])
|
|
32
|
+
s.add_dependency(%q<hoe>, ["~> 3.5"])
|
|
41
33
|
end
|
|
42
34
|
else
|
|
43
|
-
s.add_dependency(%q<minitest>, ["~> 4.
|
|
44
|
-
s.add_dependency(%q<rdoc>, ["~>
|
|
45
|
-
s.add_dependency(%q<hoe>, ["~> 3.
|
|
35
|
+
s.add_dependency(%q<minitest>, ["~> 4.6"])
|
|
36
|
+
s.add_dependency(%q<rdoc>, ["~> 3.10"])
|
|
37
|
+
s.add_dependency(%q<hoe>, ["~> 3.5"])
|
|
46
38
|
end
|
|
47
39
|
end
|
data/lib/arel/crud.rb
CHANGED
|
@@ -22,7 +22,7 @@ module Arel
|
|
|
22
22
|
def update values
|
|
23
23
|
if $VERBOSE
|
|
24
24
|
warn <<-eowarn
|
|
25
|
-
update (#{caller.first}) is deprecated and will be removed in
|
|
25
|
+
update (#{caller.first}) is deprecated and will be removed in Arel 4.0.0. Please
|
|
26
26
|
switch to `compile_update`
|
|
27
27
|
eowarn
|
|
28
28
|
end
|
|
@@ -45,7 +45,7 @@ switch to `compile_update`
|
|
|
45
45
|
def insert values
|
|
46
46
|
if $VERBOSE
|
|
47
47
|
warn <<-eowarn
|
|
48
|
-
insert (#{caller.first}) is deprecated and will be removed in
|
|
48
|
+
insert (#{caller.first}) is deprecated and will be removed in Arel 4.0.0. Please
|
|
49
49
|
switch to `compile_insert`
|
|
50
50
|
eowarn
|
|
51
51
|
end
|
|
@@ -62,7 +62,7 @@ switch to `compile_insert`
|
|
|
62
62
|
def delete
|
|
63
63
|
if $VERBOSE
|
|
64
64
|
warn <<-eowarn
|
|
65
|
-
delete (#{caller.first}) is deprecated and will be removed in
|
|
65
|
+
delete (#{caller.first}) is deprecated and will be removed in Arel 4.0.0. Please
|
|
66
66
|
switch to `compile_delete`
|
|
67
67
|
eowarn
|
|
68
68
|
end
|
data/lib/arel/nodes/and.rb
CHANGED
data/lib/arel/nodes/binary.rb
CHANGED
|
@@ -13,6 +13,17 @@ module Arel
|
|
|
13
13
|
@left = @left.clone if @left
|
|
14
14
|
@right = @right.clone if @right
|
|
15
15
|
end
|
|
16
|
+
|
|
17
|
+
def hash
|
|
18
|
+
[@left, @right].hash
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def eql? other
|
|
22
|
+
self.class == other.class &&
|
|
23
|
+
self.left == other.left &&
|
|
24
|
+
self.right == other.right
|
|
25
|
+
end
|
|
26
|
+
alias :== :eql?
|
|
16
27
|
end
|
|
17
28
|
|
|
18
29
|
%w{
|
data/lib/arel/nodes/extract.rb
CHANGED
|
@@ -18,6 +18,17 @@ module Arel
|
|
|
18
18
|
self.alias = SqlLiteral.new(aliaz)
|
|
19
19
|
self
|
|
20
20
|
end
|
|
21
|
+
|
|
22
|
+
def hash
|
|
23
|
+
super ^ [@field, @alias].hash
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def eql? other
|
|
27
|
+
super &&
|
|
28
|
+
self.field == other.field &&
|
|
29
|
+
self.alias == other.alias
|
|
30
|
+
end
|
|
31
|
+
alias :== :eql?
|
|
21
32
|
end
|
|
22
33
|
end
|
|
23
34
|
end
|
data/lib/arel/nodes/false.rb
CHANGED
data/lib/arel/nodes/function.rb
CHANGED
|
@@ -16,6 +16,17 @@ module Arel
|
|
|
16
16
|
self.alias = SqlLiteral.new(aliaz)
|
|
17
17
|
self
|
|
18
18
|
end
|
|
19
|
+
|
|
20
|
+
def hash
|
|
21
|
+
[@expressions, @alias, @distinct].hash
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def eql? other
|
|
25
|
+
self.class == other.class &&
|
|
26
|
+
self.expressions == other.expressions &&
|
|
27
|
+
self.alias == other.alias &&
|
|
28
|
+
self.distinct == other.distinct
|
|
29
|
+
end
|
|
19
30
|
end
|
|
20
31
|
|
|
21
32
|
%w{
|
|
@@ -14,6 +14,18 @@ module Arel
|
|
|
14
14
|
@columns = @columns.clone
|
|
15
15
|
@values = @values.clone if @values
|
|
16
16
|
end
|
|
17
|
+
|
|
18
|
+
def hash
|
|
19
|
+
[@relation, @columns, @values].hash
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def eql? other
|
|
23
|
+
self.class == other.class &&
|
|
24
|
+
self.relation == other.relation &&
|
|
25
|
+
self.columns == other.columns &&
|
|
26
|
+
self.values == other.values
|
|
27
|
+
end
|
|
28
|
+
alias :== :eql?
|
|
17
29
|
end
|
|
18
30
|
end
|
|
19
31
|
end
|
|
@@ -37,6 +37,26 @@ module Arel
|
|
|
37
37
|
@having = @having.clone if @having
|
|
38
38
|
@windows = @windows.clone
|
|
39
39
|
end
|
|
40
|
+
|
|
41
|
+
def hash
|
|
42
|
+
[
|
|
43
|
+
@source, @top, @set_quantifier, @projections,
|
|
44
|
+
@wheres, @groups, @having, @windows
|
|
45
|
+
].hash
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def eql? other
|
|
49
|
+
self.class == other.class &&
|
|
50
|
+
self.source == other.source &&
|
|
51
|
+
self.top == other.top &&
|
|
52
|
+
self.set_quantifier == other.set_quantifier &&
|
|
53
|
+
self.projections == other.projections &&
|
|
54
|
+
self.wheres == other.wheres &&
|
|
55
|
+
self.groups == other.groups &&
|
|
56
|
+
self.having == other.having &&
|
|
57
|
+
self.windows == other.windows
|
|
58
|
+
end
|
|
59
|
+
alias :== :eql?
|
|
40
60
|
end
|
|
41
61
|
end
|
|
42
62
|
end
|
|
@@ -5,7 +5,6 @@ module Arel
|
|
|
5
5
|
attr_accessor :limit, :orders, :lock, :offset, :with
|
|
6
6
|
|
|
7
7
|
def initialize cores = [SelectCore.new]
|
|
8
|
-
#puts caller
|
|
9
8
|
@cores = cores
|
|
10
9
|
@orders = []
|
|
11
10
|
@limit = nil
|
|
@@ -19,6 +18,21 @@ module Arel
|
|
|
19
18
|
@cores = @cores.map { |x| x.clone }
|
|
20
19
|
@orders = @orders.map { |x| x.clone }
|
|
21
20
|
end
|
|
21
|
+
|
|
22
|
+
def hash
|
|
23
|
+
[@cores, @orders, @limit, @lock, @offset, @with].hash
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def eql? other
|
|
27
|
+
self.class == other.class &&
|
|
28
|
+
self.cores == other.cores &&
|
|
29
|
+
self.orders == other.orders &&
|
|
30
|
+
self.limit == other.limit &&
|
|
31
|
+
self.lock == other.lock &&
|
|
32
|
+
self.offset == other.offset &&
|
|
33
|
+
self.with == other.with
|
|
34
|
+
end
|
|
35
|
+
alias :== :eql?
|
|
22
36
|
end
|
|
23
37
|
end
|
|
24
38
|
end
|
data/lib/arel/nodes/terminal.rb
CHANGED
data/lib/arel/nodes/true.rb
CHANGED
data/lib/arel/nodes/unary.rb
CHANGED
|
@@ -7,12 +7,21 @@ module Arel
|
|
|
7
7
|
def initialize expr
|
|
8
8
|
@expr = expr
|
|
9
9
|
end
|
|
10
|
+
|
|
11
|
+
def hash
|
|
12
|
+
@expr.hash
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def eql? other
|
|
16
|
+
self.class == other.class &&
|
|
17
|
+
self.expr == other.expr
|
|
18
|
+
end
|
|
19
|
+
alias :== :eql?
|
|
10
20
|
end
|
|
11
21
|
|
|
12
22
|
%w{
|
|
13
23
|
Bin
|
|
14
24
|
Group
|
|
15
|
-
Grouping
|
|
16
25
|
Having
|
|
17
26
|
Limit
|
|
18
27
|
Not
|
|
@@ -18,6 +18,21 @@ module Arel
|
|
|
18
18
|
@wheres = @wheres.clone
|
|
19
19
|
@values = @values.clone
|
|
20
20
|
end
|
|
21
|
+
|
|
22
|
+
def hash
|
|
23
|
+
[@relation, @wheres, @values, @orders, @limit, @key].hash
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def eql? other
|
|
27
|
+
self.class == other.class &&
|
|
28
|
+
self.relation == other.relation &&
|
|
29
|
+
self.wheres == other.wheres &&
|
|
30
|
+
self.values == other.values &&
|
|
31
|
+
self.orders == other.orders &&
|
|
32
|
+
self.limit == other.limit &&
|
|
33
|
+
self.key == other.key
|
|
34
|
+
end
|
|
35
|
+
alias :== :eql?
|
|
21
36
|
end
|
|
22
37
|
end
|
|
23
38
|
end
|