Sha256: 53a5deee9a43f00837bd0cffa8ceaa02fce959cf9a772d578991b0fb3bbb7707

Contents?: true

Size: 513 Bytes

Versions: 1

Compression:

Stored size: 513 Bytes

Contents

# frozen_string_literal: true

module ActiveRecordDataLoader
  class ConnectionOutputAdapter
    def needs_timeout_output?
      false
    end

    def copy(connection:, table:, columns:, data:, row_numbers:)
      raw_connection = connection.raw_connection
      raw_connection.copy_data("COPY #{table} (#{columns}) FROM STDIN WITH (FORMAT CSV)") do
        raw_connection.put_copy_data(data.join("\n"))
      end
    end

    def insert(connection:, command:)
      connection.insert(command)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
active_record_data_loader-1.2.0 lib/active_record_data_loader/connection_output_adapter.rb