Sha256: 2cf2435505f3b7d94c17cfa1df71baa0bc51bb5c58bc01bfc222f102b498954a

Contents?: true

Size: 710 Bytes

Versions: 4

Compression:

Stored size: 710 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 = unique_index_columns.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

4 entries across 4 versions & 1 rubygems

Version Path
upsert-2.9.10-java lib/upsert/merge_function/PG_Connection.rb
upsert-2.9.10 lib/upsert/merge_function/PG_Connection.rb
upsert-2.9.9-universal-java-11 lib/upsert/merge_function/PG_Connection.rb
upsert-2.9.9 lib/upsert/merge_function/PG_Connection.rb