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 43 def insert_conflict(opts=OPTS) 44 raise Error, "Model#insert_conflict is only supported on new model instances" unless new? 45 @insert_conflict_opts = opts 46 self 47 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 53 def _insert_dataset 54 ds = super 55 56 if @insert_conflict_opts 57 ds = ds.insert_conflict(@insert_conflict_opts) 58 end 59 60 ds 61 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 65 def use_prepared_statements_for?(type) 66 return false if type == :insert || type == :insert_select 67 super if defined?(super) 68 end