Sha256: b4615b0cb8b254c0eda2f6da2671e5d1c33789d414b52519998f78b1736e088c

Contents?: true

Size: 857 Bytes

Versions: 5

Compression:

Stored size: 857 Bytes

Contents

module Alf
  module Sql
    class Processor
      class LimitOffset < Processor

        def initialize(limit, offset, builder)
          super(builder)
          @limit = limit
          @offset = offset
        end
        attr_reader :limit, :offset

        def on_set_operator(sexpr)
          apply(builder.from_self(sexpr))
        end
        alias :on_union     :on_set_operator
        alias :on_except    :on_set_operator
        alias :on_intersect :on_set_operator

        def on_select_exp(sexpr)
          sexpr  = builder.from_self(sexpr) if obc = sexpr.limit_or_offset?
          limit_clause = builder.limit_clause(limit)
          offset_clause = builder.offset_clause(offset)
          sexpr.with_push(limit_clause, offset_clause)
        end

      end # class LimitOffset
    end # class Processor
  end # module Sql
end # module Alf

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
alf-sql-0.16.3 lib/alf/sql/processor/limit_offset.rb
alf-sql-0.16.2 lib/alf/sql/processor/limit_offset.rb
alf-sql-0.16.1 lib/alf/sql/processor/limit_offset.rb
alf-sql-0.16.0 lib/alf/sql/processor/limit_offset.rb
alf-sql-0.15.0 lib/alf/sql/processor/limit_offset.rb