Skip to content

Commit e466e81

Browse files
author
Anna
committed
changed to arel 4.0.1
1 parent c555932 commit e466e81

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ end
2323
if ENV['AREL']
2424
gem 'arel', :path => ENV['AREL']
2525
else
26-
gem 'arel', '4.0.0'
26+
gem 'arel', '~> 4.0.1'
2727
end
2828

2929
group :tinytds do

lib/arel/visitors/sqlserver.rb

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module Arel
44

55
module Nodes
66

7-
# Extending the Ordering class to be comparrison friendly which allows us to call #uniq on a
7+
# Extending the Ordering class to be comparison friendly which allows us to call #uniq on a
88
# collection of them. See SelectManager#order for more details.
99
class Ordering < Arel::Nodes::Unary
1010
def hash
@@ -89,51 +89,51 @@ class SQLServer < Arel::Visitors::ToSql
8989
private
9090

9191
# SQLServer ToSql/Visitor (Overides)
92-
# TODO: Change for arel 4.0.1
93-
def visit_Arel_Nodes_SelectStatement(o)
92+
93+
def visit_Arel_Nodes_SelectStatement(o, a)
9494
if complex_count_sql?(o)
95-
visit_Arel_Nodes_SelectStatementForComplexCount(o)
95+
visit_Arel_Nodes_SelectStatementForComplexCount(o, a)
9696
elsif o.offset
97-
visit_Arel_Nodes_SelectStatementWithOffset(o)
97+
visit_Arel_Nodes_SelectStatementWithOffset(o, a)
9898
else
99-
visit_Arel_Nodes_SelectStatementWithOutOffset(o)
99+
visit_Arel_Nodes_SelectStatementWithOutOffset(o, a)
100100
end
101101
end
102-
103-
def visit_Arel_Nodes_UpdateStatement(o)
102+
103+
def visit_Arel_Nodes_UpdateStatement(o, a)
104104
if o.orders.any? && o.limit.nil?
105105
o.limit = Nodes::Limit.new(9223372036854775807)
106106
end
107107
super
108108
end
109109

110-
def visit_Arel_Nodes_Offset(o)
110+
def visit_Arel_Nodes_Offset(o, a)
111111
"WHERE [__rnt].[__rn] > (#{visit o.expr})"
112112
end
113113

114-
def visit_Arel_Nodes_Limit(o)
114+
def visit_Arel_Nodes_Limit(o, a)
115115
"TOP (#{visit o.expr})"
116116
end
117117

118-
def visit_Arel_Nodes_Lock(o)
118+
def visit_Arel_Nodes_Lock(o, a)
119119
visit o.expr
120120
end
121-
122-
def visit_Arel_Nodes_Ordering(o)
121+
122+
def visit_Arel_Nodes_Ordering(o, a)
123123
if o.respond_to?(:direction)
124124
"#{visit o.expr} #{o.ascending? ? 'ASC' : 'DESC'}"
125125
else
126126
visit o.expr
127127
end
128128
end
129-
130-
def visit_Arel_Nodes_Bin(o)
129+
130+
def visit_Arel_Nodes_Bin(o, a)
131131
"#{visit o.expr} #{@connection.cs_equality_operator}"
132132
end
133133

134134
# SQLServer ToSql/Visitor (Additions)
135135

136-
def visit_Arel_Nodes_SelectStatementWithOutOffset(o, windowed=false)
136+
def visit_Arel_Nodes_SelectStatementWithOutOffset(o, a, windowed = false)
137137
find_and_fix_uncorrelated_joins_in_select_statement(o)
138138
core = o.cores.first
139139
projections = core.projections
@@ -165,7 +165,7 @@ def visit_Arel_Nodes_SelectStatementWithOutOffset(o, windowed=false)
165165
].compact.join ' '
166166
end
167167

168-
def visit_Arel_Nodes_SelectStatementWithOffset(o)
168+
def visit_Arel_Nodes_SelectStatementWithOffset(o, a)
169169
core = o.cores.first
170170
o.limit ||= Arel::Nodes::Limit.new(9223372036854775807)
171171
orders = rowtable_orders(o)
@@ -174,14 +174,14 @@ def visit_Arel_Nodes_SelectStatementWithOffset(o)
174174
(rowtable_projections(o).map{ |x| visit(x) }.join(', ')),
175175
"FROM (",
176176
"SELECT #{core.set_quantifier ? 'DISTINCT DENSE_RANK()' : 'ROW_NUMBER()'} OVER (ORDER BY #{orders.map{ |x| visit(x) }.join(', ')}) AS [__rn],",
177-
visit_Arel_Nodes_SelectStatementWithOutOffset(o,true),
177+
visit_Arel_Nodes_SelectStatementWithOutOffset(o, a, true),
178178
") AS [__rnt]",
179179
(visit(o.offset) if o.offset),
180180
"ORDER BY [__rnt].[__rn] ASC"
181181
].compact.join ' '
182182
end
183183

184-
def visit_Arel_Nodes_SelectStatementForComplexCount(o)
184+
def visit_Arel_Nodes_SelectStatementForComplexCount(o, a)
185185
core = o.cores.first
186186
o.limit.expr = Arel.sql("#{o.limit.expr} + #{o.offset ? o.offset.expr : 0}") if o.limit
187187
orders = rowtable_orders(o)

0 commit comments

Comments
 (0)