Sha256: f847cd1d724970dc8135979475eb115481b6520e57fdb48b04622bd1ec9e157c

Contents?: true

Size: 622 Bytes

Versions: 3

Compression:

Stored size: 622 Bytes

Contents

require 'arel/visitors/compat'

module Arel
  module Visitors
    class Firebird < Arel::Visitors::ToSql

      def visit_Arel_Nodes_SelectStatement o, a = nil
        lim_off = ''
        lim_off << "FIRST #{do_visit o.limit.expr, a} " if o.limit
        lim_off << " SKIP #{do_visit o.offset.expr, a}" if o.offset
        lim_off.strip!

        sql = o.cores.map { |x| do_visit_select_core x, a }.join
        sql << " ORDER BY #{o.orders.map { |x| do_visit x, a }.join(', ')}" unless o.orders.empty?

        sql.sub!(/\A(\s*SELECT\s)/i, "\&#{lim_off} ") unless lim_off.empty?
        sql
      end

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
activerecord-jdbc-adapter-1.3.10 lib/arel/visitors/firebird.rb
activerecord-jdbc-adapter-1.3.9 lib/arel/visitors/firebird.rb
activerecord-jdbc-adapter-1.3.8 lib/arel/visitors/firebird.rb