Sha256: bd564a5a9113949c7aa351a9fcd099b336759d1899897aea3b175f12b3a19373

Contents?: true

Size: 634 Bytes

Versions: 2

Compression:

Stored size: 634 Bytes

Contents

module Arel
  module Visitors
    class RubyFB_15Compat < Arel::Visitors::ToSql
    	Arel::Visitors::VISITORS['rubyfb'] = Arel::Visitors::RubyFB_15Compat
    private
      def visit_Arel_Nodes_SelectStatement o
      	limit = o.limit; o.limit = nil;
      	offset = o.offset; o.offset = nil;
      	super.tap do |s|
      	  if limit || offset  
      	    s.gsub!(/^\s*select/i, "SELECT #{fb_limit(limit)} #{fb_offset(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

2 entries across 2 versions & 1 rubygems

Version Path
rubyfb-0.5.9 lib/arel/visitors/rubyfb_15compat.rb
rubyfb-0.5.8 lib/arel/visitors/rubyfb_15compat.rb