Permalink
Browse files

we do not need to modify the AST

  • Loading branch information...
1 parent b035def commit fd24494797461d487bacc277b4ff32392c64906d @tenderlove tenderlove committed Jan 3, 2011
Showing with 4 additions and 3 deletions.
  1. +4 −3 lib/arel/visitors/oracle.rb
@@ -12,15 +12,13 @@ def visit_Arel_Nodes_SelectStatement o
o.cores.last.wheres.push Nodes::LessThanOrEqual.new(
Nodes::SqlLiteral.new('ROWNUM'), o.limit.expr
)
- o.limit = nil
return super
end
if o.limit && o.offset
o = o.dup
limit = o.limit.expr.to_i
offset = o.offset
- o.limit = nil
o.offset = nil
sql = super(o)
return <<-eosql
@@ -36,7 +34,6 @@ def visit_Arel_Nodes_SelectStatement o
if o.limit
o = o.dup
limit = o.limit.expr
- o.limit = nil
return "SELECT * FROM (#{super(o)}) WHERE ROWNUM <= #{visit limit}"
end
@@ -57,6 +54,10 @@ def visit_Arel_Nodes_SelectStatement o
super
end
+ def visit_Arel_Nodes_Limit o
+ ''
+ end
+
def visit_Arel_Nodes_Offset o
"raw_rnum_ > #{visit o.value}"
end

0 comments on commit fd24494

Please sign in to comment.