module Sequel::Plugins::UpdateRefresh::InstanceMethods

Public Instance Methods

after_update() click to toggle source

If the dataset does not support UPDATE RETURNING, then refresh after an update.

Calls superclass method
   # File lib/sequel/plugins/update_refresh.rb
60 def after_update
61   super
62   unless this.supports_returning?(:update)
63     refresh
64   end
65 end

Private Instance Methods

_update_without_checking(columns) click to toggle source

If the dataset supports UPDATE RETURNING, use it to do the refresh in the same query as the update.

Calls superclass method
   # File lib/sequel/plugins/update_refresh.rb
71 def _update_without_checking(columns)
72   ds = _update_dataset
73   if ds.supports_returning?(:update)
74     ds = ds.opts[:returning] ? ds : ds.returning(*self.class.update_refresh_columns)
75     rows = ds.update(columns)
76     n = rows.length
77     if n == 1
78       @values.merge!(rows.first)
79     end
80     n
81   else
82     super
83   end
84 end