Sha256: 28f130898e08c1ea689d76e7091ce7f4ec721f28e8390f291f2702554b6f8ed9

Contents?: true

Size: 577 Bytes

Versions: 4

Compression:

Stored size: 577 Bytes

Contents

module Arel
  module Visitors
    class RubyFB < Arel::Visitors::ToSql
    private
      def visit_Arel_Nodes_Limit o
      end

      def visit_Arel_Nodes_Offset o
      end
      
      def visit_Arel_Nodes_SelectStatement o
      	super.tap do |s|
      	  if o.limit || o.offset  
      	    s.gsub!(/^\s*select/i, "SELECT #{fb_limit(o.limit)} #{fb_offset(o.offset)} ")
      	  end
      	end
      end

      def fb_limit limit
      	"first #{limit.expr}" if limit
      end

      def fb_offset offset
      	"skip #{offset.expr}" if offset
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rubyfb-0.6.7 lib/arel/visitors/fb15/rubyfb.rb
rubyfb-0.6.4 lib/arel/visitors/fb15/rubyfb.rb
rubyfb-0.6.3 lib/arel/visitors/fb15/rubyfb.rb
rubyfb-0.6.2 lib/arel/visitors/fb15/rubyfb.rb