Sha256: 213fcf2b767cf17ca1b8f100c4fe68fbb9f32ebd2a02369c35ffbc8e4fff4aff

Contents?: true

Size: 576 Bytes

Versions: 14

Compression:

Stored size: 576 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: options).call
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
table_saw-3.1.0 lib/table_saw/formats/insert.rb
table_saw-3.0.0 lib/table_saw/formats/insert.rb
table_saw-2.10.0 lib/table_saw/formats/insert.rb
table_saw-2.9.0 lib/table_saw/formats/insert.rb
table_saw-2.8.1 lib/table_saw/formats/insert.rb
table_saw-2.8.0 lib/table_saw/formats/insert.rb
table_saw-2.7.0 lib/table_saw/formats/insert.rb
table_saw-2.6.0 lib/table_saw/formats/insert.rb
table_saw-2.5.0 lib/table_saw/formats/insert.rb
table_saw-2.4.3 lib/table_saw/formats/insert.rb
table_saw-2.4.2 lib/table_saw/formats/insert.rb
table_saw-2.4.1 lib/table_saw/formats/insert.rb
table_saw-2.4.0 lib/table_saw/formats/insert.rb
table_saw-2.3.0 lib/table_saw/formats/insert.rb