module Sequel::Plugins::SelectOnSkippedUpdate::InstanceMethods
Public Instance Methods
Source
# File lib/sequel/plugins/select_on_skipped_update.rb 37 def save_changes(opts=OPTS) 38 ret = super 39 run_select_on_skipped_update if ret.nil? && require_modification 40 ret 41 end
If an UPDATE statement was skipped as the object wasn’t modified, run a SELECT query.
Calls superclass method
Private Instance Methods
Source
# File lib/sequel/plugins/select_on_skipped_update.rb 46 def _update_columns(columns) 47 ret = super 48 run_select_on_skipped_update if ret.nil? && columns.empty? && require_modification 49 ret 50 end
If an UPDATE statement was skipped as there were no columns to update, run a SELECT query.
Calls superclass method
Source
# File lib/sequel/plugins/select_on_skipped_update.rb 54 def run_select_on_skipped_update 55 ds = _update_dataset 56 unless ds.select(COUNT).single_value! == 1 57 raise(NoMatchingRow, "Attempt to select object did not result in a single row modification") 58 end 59 end
Run a SELECT query on the dataset to determine whether the object still exists in the database. This will result in an exception if a single row is not modified.