Sha256: dfccb7251ba845d197813e6414f6784ff646c0f001b65ddc5133f0a1c8fc5d6e

Contents?: true

Size: 702 Bytes

Versions: 1

Compression:

Stored size: 702 Bytes

Contents

require 'upsert/merge_function/postgresql'

class Upsert
  class MergeFunction
    # @private
    class PG_Connection < MergeFunction
      ERROR_CLASS = PG::Error
      include Postgresql

      def execute_parameterized(query, args = [])
        controller.connection.execute(query, args)
      end

      def unique_index_on_selector?
        return @unique_index_on_selector if defined?(@unique_index_on_selector)

        type_map = PG::TypeMapByColumn.new([PG::TextDecoder::Array.new])
        res = schema_query.tap { |r| r.type_map = type_map }

        @unique_index_on_selector = res.values.any? do |row|
          row.first.sort == selector_keys.sort
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
upsert-2.2.1 lib/upsert/merge_function/PG_Connection.rb