Sha256: 0e594bc958f9236e7e0cd1fc5f4eb9e7b51693bfa2683da4274fec2f8fec476a

Contents?: true

Size: 890 Bytes

Versions: 10

Compression:

Stored size: 890 Bytes

Contents

# rubocop:disable Naming/MethodName
# rubocop:disable Naming/UncommunicativeMethodParamName

module Arel
  module Visitors
    class Dot
      def visit_Arel_Nodes_Prepare(o)
        visit_edge o, 'name'
        visit_edge o, 'argtypes'
        visit_edge o, 'query'
      end
    end

    class ToSql
      def visit_Arel_Nodes_Prepare(o, collector)
        collector << "PREPARE #{o.name}"
        collector << " (#{o.argtypes.join(', ')})" if o.argtypes
        collector << ' AS ('
        visit(o.query, collector)
        collector << ')'
      end
    end
  end

  module Nodes
    class Prepare < Node
      attr_reader :name, :query, :argtypes

      def initialize(name, argtypes, query)
        @name = name
        @query = query
        @argtypes = argtypes
      end
    end
  end
end

# rubocop:enable Naming/MethodName
# rubocop:enable Naming/UncommunicativeMethodParamName

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
arel_toolkit-0.4.9 lib/arel/extensions/prepare.rb
arel_toolkit-0.4.8 lib/arel/extensions/prepare.rb
arel_toolkit-0.4.7 lib/arel/extensions/prepare.rb
arel_toolkit-0.4.6 lib/arel/extensions/prepare.rb
arel_toolkit-0.4.5 lib/arel/extensions/prepare.rb
arel_toolkit-0.4.4 lib/arel/extensions/prepare.rb
arel_toolkit-0.4.3 lib/arel/extensions/prepare.rb
arel_toolkit-0.4.2 lib/arel/extensions/prepare.rb
arel_toolkit-0.4.1 lib/arel/extensions/prepare.rb
arel_toolkit-0.4.0 lib/arel/extensions/prepare.rb