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
51 def insert_conflict(opts=OPTS)
52   raise Error, "Model#insert_conflict is only supported on new model instances" unless new?
53   @insert_conflict_opts = opts
54   self
55 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
61 def _insert_dataset
62   ds = super
63 
64   if @insert_conflict_opts
65     ds = ds.insert_conflict(@insert_conflict_opts)
66   end
67 
68   ds
69 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
73 def use_prepared_statements_for?(type)
74   return false if type == :insert || type == :insert_select
75   super if defined?(super)
76 end