arel 2.0.10 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (102) hide show
  1. data/History.txt +51 -4
  2. data/Manifest.txt +15 -31
  3. data/README.markdown +27 -3
  4. data/Rakefile +0 -2
  5. data/arel.gemspec +20 -19
  6. data/lib/arel.rb +9 -1
  7. data/lib/arel/alias_predication.rb +7 -0
  8. data/lib/arel/attributes/attribute.rb +10 -1
  9. data/lib/arel/crud.rb +43 -8
  10. data/lib/arel/expression.rb +1 -0
  11. data/lib/arel/factory_methods.rb +35 -0
  12. data/lib/arel/insert_manager.rb +5 -1
  13. data/lib/arel/math.rb +19 -0
  14. data/lib/arel/nodes.rb +32 -42
  15. data/lib/arel/nodes/and.rb +18 -1
  16. data/lib/arel/nodes/binary.rb +28 -0
  17. data/lib/arel/nodes/count.rb +0 -3
  18. data/lib/arel/nodes/function.rb +13 -2
  19. data/lib/arel/nodes/infix_operation.rb +43 -0
  20. data/lib/arel/nodes/join_source.rb +14 -0
  21. data/lib/arel/nodes/named_function.rb +14 -0
  22. data/lib/arel/nodes/node.rb +5 -2
  23. data/lib/arel/nodes/select_core.rb +24 -10
  24. data/lib/arel/nodes/select_statement.rb +8 -6
  25. data/lib/arel/nodes/sql_literal.rb +2 -0
  26. data/lib/arel/nodes/string_join.rb +2 -4
  27. data/lib/arel/nodes/table_alias.rb +7 -3
  28. data/lib/arel/nodes/{as.rb → terminal.rb} +1 -1
  29. data/lib/arel/nodes/unary.rb +17 -0
  30. data/lib/arel/nodes/unqualified_column.rb +4 -0
  31. data/lib/arel/nodes/update_statement.rb +4 -2
  32. data/lib/arel/nodes/with.rb +10 -0
  33. data/lib/arel/order_predications.rb +13 -0
  34. data/lib/arel/predications.rb +6 -24
  35. data/lib/arel/select_manager.rb +95 -40
  36. data/lib/arel/table.rb +32 -19
  37. data/lib/arel/tree_manager.rb +1 -0
  38. data/lib/arel/update_manager.rb +4 -0
  39. data/lib/arel/visitors.rb +2 -0
  40. data/lib/arel/visitors/depth_first.rb +19 -9
  41. data/lib/arel/visitors/dot.rb +42 -25
  42. data/lib/arel/visitors/ibm_db.rb +12 -0
  43. data/lib/arel/visitors/join_sql.rb +2 -23
  44. data/lib/arel/visitors/mssql.rb +7 -0
  45. data/lib/arel/visitors/mysql.rb +4 -0
  46. data/lib/arel/visitors/oracle.rb +2 -2
  47. data/lib/arel/visitors/postgresql.rb +2 -38
  48. data/lib/arel/visitors/to_sql.rb +148 -67
  49. data/test/attributes/test_attribute.rb +3 -3
  50. data/test/helper.rb +1 -1
  51. data/test/nodes/test_as.rb +6 -0
  52. data/test/nodes/test_bin.rb +23 -0
  53. data/test/nodes/test_named_function.rb +30 -0
  54. data/test/nodes/test_node.rb +10 -0
  55. data/test/nodes/test_not.rb +4 -7
  56. data/test/nodes/test_select_core.rb +23 -14
  57. data/test/support/fake_record.rb +21 -4
  58. data/test/test_attributes.rb +8 -0
  59. data/test/test_crud.rb +6 -12
  60. data/test/test_factory_methods.rb +34 -0
  61. data/test/test_insert_manager.rb +19 -0
  62. data/test/test_select_manager.rb +343 -64
  63. data/test/test_table.rb +36 -45
  64. data/test/visitors/test_depth_first.rb +29 -11
  65. data/test/visitors/test_dot.rb +47 -0
  66. data/test/visitors/test_ibm_db.rb +27 -0
  67. data/test/visitors/test_join_sql.rb +14 -7
  68. data/test/visitors/test_mssql.rb +9 -0
  69. data/test/visitors/test_oracle.rb +11 -10
  70. data/test/visitors/test_postgres.rb +12 -0
  71. data/test/visitors/test_to_sql.rb +80 -17
  72. metadata +80 -101
  73. data/lib/arel/nodes/assignment.rb +0 -6
  74. data/lib/arel/nodes/avg.rb +0 -6
  75. data/lib/arel/nodes/between.rb +0 -6
  76. data/lib/arel/nodes/does_not_match.rb +0 -6
  77. data/lib/arel/nodes/except.rb +0 -7
  78. data/lib/arel/nodes/exists.rb +0 -7
  79. data/lib/arel/nodes/greater_than.rb +0 -6
  80. data/lib/arel/nodes/greater_than_or_equal.rb +0 -6
  81. data/lib/arel/nodes/group.rb +0 -6
  82. data/lib/arel/nodes/grouping.rb +0 -6
  83. data/lib/arel/nodes/having.rb +0 -6
  84. data/lib/arel/nodes/intersect.rb +0 -7
  85. data/lib/arel/nodes/join.rb +0 -13
  86. data/lib/arel/nodes/less_than.rb +0 -6
  87. data/lib/arel/nodes/less_than_or_equal.rb +0 -6
  88. data/lib/arel/nodes/limit.rb +0 -7
  89. data/lib/arel/nodes/lock.rb +0 -6
  90. data/lib/arel/nodes/matches.rb +0 -6
  91. data/lib/arel/nodes/max.rb +0 -6
  92. data/lib/arel/nodes/min.rb +0 -6
  93. data/lib/arel/nodes/not.rb +0 -6
  94. data/lib/arel/nodes/not_equal.rb +0 -6
  95. data/lib/arel/nodes/not_in.rb +0 -6
  96. data/lib/arel/nodes/offset.rb +0 -7
  97. data/lib/arel/nodes/on.rb +0 -6
  98. data/lib/arel/nodes/or.rb +0 -6
  99. data/lib/arel/nodes/sum.rb +0 -6
  100. data/lib/arel/nodes/top.rb +0 -6
  101. data/lib/arel/nodes/union.rb +0 -7
  102. data/lib/arel/nodes/union_all.rb +0 -7
metadata CHANGED
@@ -1,10 +1,15 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: arel
3
- version: !ruby/object:Gem::Version
4
- version: 2.0.10
3
+ version: !ruby/object:Gem::Version
4
+ hash: 11
5
5
  prerelease:
6
+ segments:
7
+ - 2
8
+ - 1
9
+ - 0
10
+ version: 2.1.0
6
11
  platform: ruby
7
- authors:
12
+ authors:
8
13
  - Aaron Patterson
9
14
  - Bryan Halmkamp
10
15
  - Emilio Tagua
@@ -12,71 +17,51 @@ authors:
12
17
  autorequire:
13
18
  bindir: bin
14
19
  cert_chain: []
15
- date: 2011-05-17 00:00:00.000000000 Z
16
- dependencies:
17
- - !ruby/object:Gem::Dependency
18
- name: minitest
19
- requirement: &2157239820 !ruby/object:Gem::Requirement
20
- none: false
21
- requirements:
22
- - - ! '>='
23
- - !ruby/object:Gem::Version
24
- version: 2.0.2
25
- type: :development
26
- prerelease: false
27
- version_requirements: *2157239820
28
- - !ruby/object:Gem::Dependency
20
+
21
+ date: 2011-05-01 00:00:00 Z
22
+ dependencies:
23
+ - !ruby/object:Gem::Dependency
29
24
  name: hoe
30
- requirement: &2157239280 !ruby/object:Gem::Requirement
31
- none: false
32
- requirements:
33
- - - ! '>='
34
- - !ruby/object:Gem::Version
35
- version: 2.1.0
36
- type: :development
37
- prerelease: false
38
- version_requirements: *2157239280
39
- - !ruby/object:Gem::Dependency
40
- name: minitest
41
- requirement: &2157238760 !ruby/object:Gem::Requirement
42
- none: false
43
- requirements:
44
- - - ! '>='
45
- - !ruby/object:Gem::Version
46
- version: 1.6.0
47
- type: :development
48
25
  prerelease: false
49
- version_requirements: *2157238760
50
- - !ruby/object:Gem::Dependency
51
- name: hoe
52
- requirement: &2157238300 !ruby/object:Gem::Requirement
26
+ requirement: &id001 !ruby/object:Gem::Requirement
53
27
  none: false
54
- requirements:
55
- - - ! '>='
56
- - !ruby/object:Gem::Version
57
- version: 2.9.1
28
+ requirements:
29
+ - - ">="
30
+ - !ruby/object:Gem::Version
31
+ hash: 35
32
+ segments:
33
+ - 2
34
+ - 9
35
+ - 4
36
+ version: 2.9.4
58
37
  type: :development
59
- prerelease: false
60
- version_requirements: *2157238300
61
- description: Arel is a Relational Algebra for Ruby. It 1) simplifies the generation
62
- complex of SQL queries and it 2) adapts to various RDBMS systems. It is intended
63
- to be a framework framework; that is, you can build your own ORM with it, focusing
64
- on innovative object and collection modeling as opposed to database compatibility
65
- and query generation.
66
- email:
38
+ version_requirements: *id001
39
+ description: |-
40
+ Arel is a SQL AST manager for Ruby. It
41
+
42
+ 1. Simplifies the generation complex of SQL queries
43
+ 2. Adapts to various RDBMS systems
44
+
45
+ It is intended to be a framework framework; that is, you can build your own ORM
46
+ with it, focusing on innovative object and collection modeling as opposed to
47
+ database compatibility and query generation.
48
+ email:
67
49
  - aaron@tenderlovemaking.com
68
50
  - bryan@brynary.com
69
51
  - miloops@gmail.com
70
52
  - nick@example.org
71
53
  executables: []
54
+
72
55
  extensions: []
73
- extra_rdoc_files:
56
+
57
+ extra_rdoc_files:
74
58
  - History.txt
75
59
  - MIT-LICENSE.txt
76
60
  - Manifest.txt
77
61
  - README.markdown
78
- files:
62
+ files:
79
63
  - .autotest
64
+ - .gemtest
80
65
  - History.txt
81
66
  - MIT-LICENSE.txt
82
67
  - Manifest.txt
@@ -84,6 +69,7 @@ files:
84
69
  - Rakefile
85
70
  - arel.gemspec
86
71
  - lib/arel.rb
72
+ - lib/arel/alias_predication.rb
87
73
  - lib/arel/attributes.rb
88
74
  - lib/arel/attributes/attribute.rb
89
75
  - lib/arel/compatibility/wheres.rb
@@ -92,60 +78,37 @@ files:
92
78
  - lib/arel/deprecated.rb
93
79
  - lib/arel/expression.rb
94
80
  - lib/arel/expressions.rb
81
+ - lib/arel/factory_methods.rb
95
82
  - lib/arel/insert_manager.rb
83
+ - lib/arel/math.rb
96
84
  - lib/arel/nodes.rb
97
85
  - lib/arel/nodes/and.rb
98
- - lib/arel/nodes/as.rb
99
- - lib/arel/nodes/assignment.rb
100
- - lib/arel/nodes/avg.rb
101
- - lib/arel/nodes/between.rb
102
86
  - lib/arel/nodes/binary.rb
103
87
  - lib/arel/nodes/count.rb
104
88
  - lib/arel/nodes/delete_statement.rb
105
- - lib/arel/nodes/does_not_match.rb
106
89
  - lib/arel/nodes/equality.rb
107
- - lib/arel/nodes/except.rb
108
- - lib/arel/nodes/exists.rb
109
90
  - lib/arel/nodes/function.rb
110
- - lib/arel/nodes/greater_than.rb
111
- - lib/arel/nodes/greater_than_or_equal.rb
112
- - lib/arel/nodes/group.rb
113
- - lib/arel/nodes/grouping.rb
114
- - lib/arel/nodes/having.rb
115
91
  - lib/arel/nodes/in.rb
92
+ - lib/arel/nodes/infix_operation.rb
116
93
  - lib/arel/nodes/inner_join.rb
117
94
  - lib/arel/nodes/insert_statement.rb
118
- - lib/arel/nodes/intersect.rb
119
- - lib/arel/nodes/join.rb
120
- - lib/arel/nodes/less_than.rb
121
- - lib/arel/nodes/less_than_or_equal.rb
122
- - lib/arel/nodes/limit.rb
123
- - lib/arel/nodes/lock.rb
124
- - lib/arel/nodes/matches.rb
125
- - lib/arel/nodes/max.rb
126
- - lib/arel/nodes/min.rb
95
+ - lib/arel/nodes/join_source.rb
96
+ - lib/arel/nodes/named_function.rb
127
97
  - lib/arel/nodes/node.rb
128
- - lib/arel/nodes/not.rb
129
- - lib/arel/nodes/not_equal.rb
130
- - lib/arel/nodes/not_in.rb
131
- - lib/arel/nodes/offset.rb
132
- - lib/arel/nodes/on.rb
133
- - lib/arel/nodes/or.rb
134
98
  - lib/arel/nodes/ordering.rb
135
99
  - lib/arel/nodes/outer_join.rb
136
100
  - lib/arel/nodes/select_core.rb
137
101
  - lib/arel/nodes/select_statement.rb
138
102
  - lib/arel/nodes/sql_literal.rb
139
103
  - lib/arel/nodes/string_join.rb
140
- - lib/arel/nodes/sum.rb
141
104
  - lib/arel/nodes/table_alias.rb
142
- - lib/arel/nodes/top.rb
105
+ - lib/arel/nodes/terminal.rb
143
106
  - lib/arel/nodes/unary.rb
144
- - lib/arel/nodes/union.rb
145
- - lib/arel/nodes/union_all.rb
146
107
  - lib/arel/nodes/unqualified_column.rb
147
108
  - lib/arel/nodes/update_statement.rb
148
109
  - lib/arel/nodes/values.rb
110
+ - lib/arel/nodes/with.rb
111
+ - lib/arel/order_predications.rb
149
112
  - lib/arel/predications.rb
150
113
  - lib/arel/relation.rb
151
114
  - lib/arel/select_manager.rb
@@ -157,6 +120,7 @@ files:
157
120
  - lib/arel/visitors.rb
158
121
  - lib/arel/visitors/depth_first.rb
159
122
  - lib/arel/visitors/dot.rb
123
+ - lib/arel/visitors/ibm_db.rb
160
124
  - lib/arel/visitors/join_sql.rb
161
125
  - lib/arel/visitors/mssql.rb
162
126
  - lib/arel/visitors/mysql.rb
@@ -170,10 +134,12 @@ files:
170
134
  - test/attributes/test_attribute.rb
171
135
  - test/helper.rb
172
136
  - test/nodes/test_as.rb
137
+ - test/nodes/test_bin.rb
173
138
  - test/nodes/test_count.rb
174
139
  - test/nodes/test_delete_statement.rb
175
140
  - test/nodes/test_equality.rb
176
141
  - test/nodes/test_insert_statement.rb
142
+ - test/nodes/test_named_function.rb
177
143
  - test/nodes/test_node.rb
178
144
  - test/nodes/test_not.rb
179
145
  - test/nodes/test_or.rb
@@ -187,12 +153,14 @@ files:
187
153
  - test/test_attributes.rb
188
154
  - test/test_crud.rb
189
155
  - test/test_delete_manager.rb
156
+ - test/test_factory_methods.rb
190
157
  - test/test_insert_manager.rb
191
158
  - test/test_select_manager.rb
192
159
  - test/test_table.rb
193
160
  - test/test_update_manager.rb
194
161
  - test/visitors/test_depth_first.rb
195
162
  - test/visitors/test_dot.rb
163
+ - test/visitors/test_ibm_db.rb
196
164
  - test/visitors/test_join_sql.rb
197
165
  - test/visitors/test_mssql.rb
198
166
  - test/visitors/test_mysql.rb
@@ -200,40 +168,49 @@ files:
200
168
  - test/visitors/test_postgres.rb
201
169
  - test/visitors/test_sqlite.rb
202
170
  - test/visitors/test_to_sql.rb
203
- - .gemtest
204
171
  homepage: http://github.com/rails/arel
205
172
  licenses: []
173
+
206
174
  post_install_message:
207
- rdoc_options:
175
+ rdoc_options:
208
176
  - --main
209
177
  - README.markdown
210
- require_paths:
178
+ require_paths:
211
179
  - lib
212
- required_ruby_version: !ruby/object:Gem::Requirement
180
+ required_ruby_version: !ruby/object:Gem::Requirement
213
181
  none: false
214
- requirements:
215
- - - ! '>='
216
- - !ruby/object:Gem::Version
217
- version: '0'
218
- required_rubygems_version: !ruby/object:Gem::Requirement
182
+ requirements:
183
+ - - ">="
184
+ - !ruby/object:Gem::Version
185
+ hash: 3
186
+ segments:
187
+ - 0
188
+ version: "0"
189
+ required_rubygems_version: !ruby/object:Gem::Requirement
219
190
  none: false
220
- requirements:
221
- - - ! '>='
222
- - !ruby/object:Gem::Version
223
- version: '0'
191
+ requirements:
192
+ - - ">="
193
+ - !ruby/object:Gem::Version
194
+ hash: 3
195
+ segments:
196
+ - 0
197
+ version: "0"
224
198
  requirements: []
199
+
225
200
  rubyforge_project: arel
226
- rubygems_version: 1.8.2
201
+ rubygems_version: 1.7.2
227
202
  signing_key:
228
203
  specification_version: 3
229
- summary: Arel is a Relational Algebra for Ruby
230
- test_files:
204
+ summary: Arel is a SQL AST manager for Ruby
205
+ test_files:
231
206
  - test/attributes/test_attribute.rb
232
207
  - test/nodes/test_as.rb
208
+ - test/nodes/test_bin.rb
233
209
  - test/nodes/test_count.rb
234
210
  - test/nodes/test_delete_statement.rb
235
211
  - test/nodes/test_equality.rb
236
212
  - test/nodes/test_insert_statement.rb
213
+ - test/nodes/test_named_function.rb
237
214
  - test/nodes/test_node.rb
238
215
  - test/nodes/test_not.rb
239
216
  - test/nodes/test_or.rb
@@ -246,12 +223,14 @@ test_files:
246
223
  - test/test_attributes.rb
247
224
  - test/test_crud.rb
248
225
  - test/test_delete_manager.rb
226
+ - test/test_factory_methods.rb
249
227
  - test/test_insert_manager.rb
250
228
  - test/test_select_manager.rb
251
229
  - test/test_table.rb
252
230
  - test/test_update_manager.rb
253
231
  - test/visitors/test_depth_first.rb
254
232
  - test/visitors/test_dot.rb
233
+ - test/visitors/test_ibm_db.rb
255
234
  - test/visitors/test_join_sql.rb
256
235
  - test/visitors/test_mssql.rb
257
236
  - test/visitors/test_mysql.rb
@@ -1,6 +0,0 @@
1
- module Arel
2
- module Nodes
3
- class Assignment < Arel::Nodes::Binary
4
- end
5
- end
6
- end
@@ -1,6 +0,0 @@
1
- module Arel
2
- module Nodes
3
- class Avg < Arel::Nodes::Function
4
- end
5
- end
6
- end
@@ -1,6 +0,0 @@
1
- module Arel
2
- module Nodes
3
- class Between < Arel::Nodes::Binary
4
- end
5
- end
6
- end
@@ -1,6 +0,0 @@
1
- module Arel
2
- module Nodes
3
- class DoesNotMatch < Arel::Nodes::Binary
4
- end
5
- end
6
- end
@@ -1,7 +0,0 @@
1
- module Arel
2
- module Nodes
3
- class Except < Arel::Nodes::Binary
4
- end
5
- end
6
- end
7
-
@@ -1,7 +0,0 @@
1
- module Arel
2
- module Nodes
3
- class Exists < Arel::Nodes::Function
4
- alias :select_stmt :expressions
5
- end
6
- end
7
- end
@@ -1,6 +0,0 @@
1
- module Arel
2
- module Nodes
3
- class GreaterThan < Arel::Nodes::Binary
4
- end
5
- end
6
- end
@@ -1,6 +0,0 @@
1
- module Arel
2
- module Nodes
3
- class GreaterThanOrEqual < Arel::Nodes::Binary
4
- end
5
- end
6
- end
@@ -1,6 +0,0 @@
1
- module Arel
2
- module Nodes
3
- class Group < Arel::Nodes::Unary
4
- end
5
- end
6
- end
@@ -1,6 +0,0 @@
1
- module Arel
2
- module Nodes
3
- class Grouping < Arel::Nodes::Unary
4
- end
5
- end
6
- end
@@ -1,6 +0,0 @@
1
- module Arel
2
- module Nodes
3
- class Having < Arel::Nodes::Unary
4
- end
5
- end
6
- end
@@ -1,7 +0,0 @@
1
- module Arel
2
- module Nodes
3
- class Intersect < Arel::Nodes::Binary
4
- end
5
- end
6
- end
7
-
@@ -1,13 +0,0 @@
1
- module Arel
2
- module Nodes
3
- class Join < Arel::Nodes::Node
4
- attr_accessor :left, :right, :constraint
5
-
6
- def initialize left, right, constraint
7
- @left = left
8
- @right = right
9
- @constraint = constraint
10
- end
11
- end
12
- end
13
- end
@@ -1,6 +0,0 @@
1
- module Arel
2
- module Nodes
3
- class LessThan < Arel::Nodes::Binary
4
- end
5
- end
6
- end
@@ -1,6 +0,0 @@
1
- module Arel
2
- module Nodes
3
- class LessThanOrEqual < Arel::Nodes::Binary
4
- end
5
- end
6
- end
@@ -1,7 +0,0 @@
1
- module Arel
2
- module Nodes
3
- class Limit < Arel::Nodes::Unary
4
- end
5
- end
6
- end
7
-
@@ -1,6 +0,0 @@
1
- module Arel
2
- module Nodes
3
- class Lock < Arel::Nodes::Unary
4
- end
5
- end
6
- end