arel 2.0.9 → 2.0.10
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +7 -0
- data/lib/arel.rb +1 -1
- data/lib/arel/visitors/to_sql.rb +11 -4
- data/test/nodes/test_node.rb +0 -5
- data/test/visitors/test_to_sql.rb +15 -0
- metadata +57 -91
data/History.txt
CHANGED
data/lib/arel.rb
CHANGED
data/lib/arel/visitors/to_sql.rb
CHANGED
@@ -7,13 +7,12 @@ module Arel
|
|
7
7
|
def initialize engine
|
8
8
|
@engine = engine
|
9
9
|
@connection = nil
|
10
|
-
@last_column = nil
|
11
10
|
@quoted_tables = {}
|
12
11
|
@quoted_columns = {}
|
13
12
|
end
|
14
13
|
|
15
14
|
def accept object
|
16
|
-
|
15
|
+
self.last_column = nil
|
17
16
|
@engine.connection_pool.with_connection do |conn|
|
18
17
|
@connection = conn
|
19
18
|
super
|
@@ -280,7 +279,7 @@ module Arel
|
|
280
279
|
end
|
281
280
|
|
282
281
|
def visit_Arel_Attributes_Attribute o
|
283
|
-
|
282
|
+
self.last_column = o.column
|
284
283
|
join_name = o.relation.table_alias || o.relation.name
|
285
284
|
"#{quote_table_name join_name}.#{quote_column_name o.name}"
|
286
285
|
end
|
@@ -296,7 +295,15 @@ module Arel
|
|
296
295
|
alias :visit_Arel_SqlLiteral :visit_Fixnum # This is deprecated
|
297
296
|
alias :visit_Bignum :visit_Fixnum
|
298
297
|
|
299
|
-
def visit_String o; quote(o,
|
298
|
+
def visit_String o; quote(o, last_column) end
|
299
|
+
|
300
|
+
def last_column
|
301
|
+
Thread.current[:arel_visitors_to_sql_last_column]
|
302
|
+
end
|
303
|
+
|
304
|
+
def last_column= col
|
305
|
+
Thread.current[:arel_visitors_to_sql_last_column] = col
|
306
|
+
end
|
300
307
|
|
301
308
|
alias :visit_ActiveSupport_Multibyte_Chars :visit_String
|
302
309
|
alias :visit_BigDecimal :visit_String
|
data/test/nodes/test_node.rb
CHANGED
@@ -8,6 +8,21 @@ module Arel
|
|
8
8
|
@attr = Table.new(:users)[:id]
|
9
9
|
end
|
10
10
|
|
11
|
+
it "should be thread safe around usage of last_column" do
|
12
|
+
table = Table.new(:users)
|
13
|
+
|
14
|
+
visit_integer_column = Thread.new do
|
15
|
+
Thread.stop
|
16
|
+
@visitor.send(:visit_Arel_Attributes_Attribute, @attr)
|
17
|
+
end
|
18
|
+
|
19
|
+
@visitor.accept(table[:name])
|
20
|
+
assert_equal(:string, @visitor.send(:last_column).type)
|
21
|
+
visit_integer_column.run
|
22
|
+
visit_integer_column.join
|
23
|
+
assert_equal(:string, @visitor.send(:last_column).type)
|
24
|
+
end
|
25
|
+
|
11
26
|
describe 'equality' do
|
12
27
|
it 'should handle false' do
|
13
28
|
sql = @visitor.accept Nodes::Equality.new(false, false)
|
metadata
CHANGED
@@ -1,15 +1,10 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: arel
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.0.10
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 2
|
8
|
-
- 0
|
9
|
-
- 9
|
10
|
-
version: 2.0.9
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Aaron Patterson
|
14
9
|
- Bryan Halmkamp
|
15
10
|
- Emilio Tagua
|
@@ -17,90 +12,70 @@ authors:
|
|
17
12
|
autorequire:
|
18
13
|
bindir: bin
|
19
14
|
cert_chain: []
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
dependencies:
|
24
|
-
- !ruby/object:Gem::Dependency
|
15
|
+
date: 2011-05-17 00:00:00.000000000 Z
|
16
|
+
dependencies:
|
17
|
+
- !ruby/object:Gem::Dependency
|
25
18
|
name: minitest
|
26
|
-
|
27
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
19
|
+
requirement: &2157239820 !ruby/object:Gem::Requirement
|
28
20
|
none: false
|
29
|
-
requirements:
|
30
|
-
- -
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
|
33
|
-
segments:
|
34
|
-
- 2
|
35
|
-
- 0
|
36
|
-
- 0
|
37
|
-
version: 2.0.0
|
21
|
+
requirements:
|
22
|
+
- - ! '>='
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: 2.0.2
|
38
25
|
type: :development
|
39
|
-
version_requirements: *id001
|
40
|
-
- !ruby/object:Gem::Dependency
|
41
|
-
name: hoe
|
42
26
|
prerelease: false
|
43
|
-
|
27
|
+
version_requirements: *2157239820
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: hoe
|
30
|
+
requirement: &2157239280 !ruby/object:Gem::Requirement
|
44
31
|
none: false
|
45
|
-
requirements:
|
46
|
-
- -
|
47
|
-
- !ruby/object:Gem::Version
|
48
|
-
hash: 11
|
49
|
-
segments:
|
50
|
-
- 2
|
51
|
-
- 1
|
52
|
-
- 0
|
32
|
+
requirements:
|
33
|
+
- - ! '>='
|
34
|
+
- !ruby/object:Gem::Version
|
53
35
|
version: 2.1.0
|
54
36
|
type: :development
|
55
|
-
version_requirements: *id002
|
56
|
-
- !ruby/object:Gem::Dependency
|
57
|
-
name: minitest
|
58
37
|
prerelease: false
|
59
|
-
|
38
|
+
version_requirements: *2157239280
|
39
|
+
- !ruby/object:Gem::Dependency
|
40
|
+
name: minitest
|
41
|
+
requirement: &2157238760 !ruby/object:Gem::Requirement
|
60
42
|
none: false
|
61
|
-
requirements:
|
62
|
-
- -
|
63
|
-
- !ruby/object:Gem::Version
|
64
|
-
hash: 15
|
65
|
-
segments:
|
66
|
-
- 1
|
67
|
-
- 6
|
68
|
-
- 0
|
43
|
+
requirements:
|
44
|
+
- - ! '>='
|
45
|
+
- !ruby/object:Gem::Version
|
69
46
|
version: 1.6.0
|
70
47
|
type: :development
|
71
|
-
version_requirements: *id003
|
72
|
-
- !ruby/object:Gem::Dependency
|
73
|
-
name: hoe
|
74
48
|
prerelease: false
|
75
|
-
|
49
|
+
version_requirements: *2157238760
|
50
|
+
- !ruby/object:Gem::Dependency
|
51
|
+
name: hoe
|
52
|
+
requirement: &2157238300 !ruby/object:Gem::Requirement
|
76
53
|
none: false
|
77
|
-
requirements:
|
78
|
-
- -
|
79
|
-
- !ruby/object:Gem::Version
|
80
|
-
hash: 41
|
81
|
-
segments:
|
82
|
-
- 2
|
83
|
-
- 9
|
84
|
-
- 1
|
54
|
+
requirements:
|
55
|
+
- - ! '>='
|
56
|
+
- !ruby/object:Gem::Version
|
85
57
|
version: 2.9.1
|
86
58
|
type: :development
|
87
|
-
|
88
|
-
|
89
|
-
|
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:
|
90
67
|
- aaron@tenderlovemaking.com
|
91
68
|
- bryan@brynary.com
|
92
69
|
- miloops@gmail.com
|
93
70
|
- nick@example.org
|
94
71
|
executables: []
|
95
|
-
|
96
72
|
extensions: []
|
97
|
-
|
98
|
-
extra_rdoc_files:
|
73
|
+
extra_rdoc_files:
|
99
74
|
- History.txt
|
100
75
|
- MIT-LICENSE.txt
|
101
76
|
- Manifest.txt
|
102
77
|
- README.markdown
|
103
|
-
files:
|
78
|
+
files:
|
104
79
|
- .autotest
|
105
80
|
- History.txt
|
106
81
|
- MIT-LICENSE.txt
|
@@ -226,42 +201,33 @@ files:
|
|
226
201
|
- test/visitors/test_sqlite.rb
|
227
202
|
- test/visitors/test_to_sql.rb
|
228
203
|
- .gemtest
|
229
|
-
has_rdoc: true
|
230
204
|
homepage: http://github.com/rails/arel
|
231
205
|
licenses: []
|
232
|
-
|
233
206
|
post_install_message:
|
234
|
-
rdoc_options:
|
207
|
+
rdoc_options:
|
235
208
|
- --main
|
236
209
|
- README.markdown
|
237
|
-
require_paths:
|
210
|
+
require_paths:
|
238
211
|
- lib
|
239
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
212
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
240
213
|
none: false
|
241
|
-
requirements:
|
242
|
-
- -
|
243
|
-
- !ruby/object:Gem::Version
|
244
|
-
|
245
|
-
|
246
|
-
- 0
|
247
|
-
version: "0"
|
248
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
214
|
+
requirements:
|
215
|
+
- - ! '>='
|
216
|
+
- !ruby/object:Gem::Version
|
217
|
+
version: '0'
|
218
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
249
219
|
none: false
|
250
|
-
requirements:
|
251
|
-
- -
|
252
|
-
- !ruby/object:Gem::Version
|
253
|
-
|
254
|
-
segments:
|
255
|
-
- 0
|
256
|
-
version: "0"
|
220
|
+
requirements:
|
221
|
+
- - ! '>='
|
222
|
+
- !ruby/object:Gem::Version
|
223
|
+
version: '0'
|
257
224
|
requirements: []
|
258
|
-
|
259
225
|
rubyforge_project: arel
|
260
|
-
rubygems_version: 1.
|
226
|
+
rubygems_version: 1.8.2
|
261
227
|
signing_key:
|
262
228
|
specification_version: 3
|
263
229
|
summary: Arel is a Relational Algebra for Ruby
|
264
|
-
test_files:
|
230
|
+
test_files:
|
265
231
|
- test/attributes/test_attribute.rb
|
266
232
|
- test/nodes/test_as.rb
|
267
233
|
- test/nodes/test_count.rb
|