Sha256: dd5e7977c51fa21adac4ae2247eca49cf95ac4e7d0096dd0ae45a97c1d210948

Contents?: true

Size: 568 Bytes

Versions: 1

Compression:

Stored size: 568 Bytes

Contents

# frozen_string_literal: true

module TableSaw
  module Formats
    class Insert < TableSaw::Formats::Base
      def header
        prepared_statement.sql
      end

      def footer
        "\n"
      end

      def dump_row(row)
        TableSaw::Queries::ExecuteInsertStatement.new(prepared_statement, row).call
      end

      def coder
        PG::TextDecoder::CopyRow.new
      end

      private

      def prepared_statement
        @prepared_statement ||= TableSaw::Queries::PreparedInsertStatement.new(table_name, options:).call
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
table_saw-3.2.0 lib/table_saw/formats/insert.rb