Sha256: cb09f6ac2dfb1b70f3c38a81f33795604e223d7817edced5f3119104cbb3714c

Contents?: true

Size: 948 Bytes

Versions: 36

Compression:

Stored size: 948 Bytes

Contents

# frozen_string_literal: true

module Arel # :nodoc: all
  module Visitors
    class IBM_DB < Arel::Visitors::ToSql
      private
        def visit_Arel_Nodes_SelectCore(o, collector)
          collector = super
          maybe_visit o.optimizer_hints, collector
        end

        def visit_Arel_Nodes_OptimizerHints(o, collector)
          hints = o.expr.map { |v| sanitize_as_sql_comment(v) }.join
          collector << "/* <OPTGUIDELINES>#{hints}</OPTGUIDELINES> */"
        end

        def visit_Arel_Nodes_Limit(o, collector)
          collector << "FETCH FIRST "
          collector = visit o.expr, collector
          collector << " ROWS ONLY"
        end

        def is_distinct_from(o, collector)
          collector << "DECODE("
          collector = visit [o.left, o.right, 0, 1], collector
          collector << ")"
        end

        def collect_optimizer_hints(o, collector)
          collector
        end
    end
  end
end

Version data entries

36 entries across 36 versions & 4 rubygems

Version Path
activerecord-6.0.6.1 lib/arel/visitors/ibm_db.rb
activerecord-6.0.6 lib/arel/visitors/ibm_db.rb
activerecord-6.0.5.1 lib/arel/visitors/ibm_db.rb
activerecord-6.0.5 lib/arel/visitors/ibm_db.rb
activerecord-6.0.4.8 lib/arel/visitors/ibm_db.rb
activerecord-6.0.4.7 lib/arel/visitors/ibm_db.rb
activerecord-6.0.4.6 lib/arel/visitors/ibm_db.rb
activerecord-6.0.4.5 lib/arel/visitors/ibm_db.rb
activerecord-6.0.4.4 lib/arel/visitors/ibm_db.rb
activerecord-6.0.4.3 lib/arel/visitors/ibm_db.rb
activerecord-6.0.4.2 lib/arel/visitors/ibm_db.rb
activerecord-6.0.4.1 lib/arel/visitors/ibm_db.rb
activerecord-6.0.4 lib/arel/visitors/ibm_db.rb
activerecord-6.0.3.7 lib/arel/visitors/ibm_db.rb
activerecord-6.0.3.6 lib/arel/visitors/ibm_db.rb
activerecord-6.0.3.5 lib/arel/visitors/ibm_db.rb
activerecord-6.0.3.4 lib/arel/visitors/ibm_db.rb
activerecord-6.0.3.3 lib/arel/visitors/ibm_db.rb
activerecord-6.0.3.2 lib/arel/visitors/ibm_db.rb
activerecord-6.0.3.1 lib/arel/visitors/ibm_db.rb