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 47 def insert_conflict(opts=OPTS) 48 raise Error, "Model#insert_conflict is only supported on new model instances" unless new? 49 @insert_conflict_opts = opts 50 self 51 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 57 def _insert_dataset 58 ds = super 59 60 if @insert_conflict_opts 61 ds = ds.insert_conflict(@insert_conflict_opts) 62 end 63 64 ds 65 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 69 def use_prepared_statements_for?(type) 70 return false if type == :insert || type == :insert_select 71 super if defined?(super) 72 end