module Sequel::Plugins::InsertConflict::InstanceMethods

Public Instance Methods

insert_conflict(opts=OPTS) click to toggle source

Set the #insert_conflict options to pass to the dataset when inserting.

# File lib/sequel/plugins/insert_conflict.rb, line 43
def insert_conflict(opts=OPTS)
  raise Error, "Model#insert_conflict is only supported on new model instances" unless new?
  @insert_conflict_opts = opts
  self
end

Private Instance Methods

_insert_dataset() click to toggle source

Set the dataset used for inserting to use INSERT ON CONFLICT Model#insert_conflict has been called on the instance previously.

Calls superclass method
# File lib/sequel/plugins/insert_conflict.rb, line 53
def _insert_dataset
  ds = super

  if @insert_conflict_opts
    ds = ds.insert_conflict(@insert_conflict_opts)
  end

  ds
end
use_prepared_statements_for?(type) click to toggle source

Disable the use of prepared insert statements, as they are not compatible with this plugin.

Calls superclass method
# File lib/sequel/plugins/insert_conflict.rb, line 65
def use_prepared_statements_for?(type)
  return false if type == :insert || type == :insert_select
  super if defined?(super)
end