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, line 60
def after_update
  super
  unless this.supports_returning?(:update)
    refresh
  end
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, line 71
def _update_without_checking(columns)
  ds = _update_dataset
  if ds.supports_returning?(:update)
    ds = ds.opts[:returning] ? ds : ds.returning(*self.class.update_refresh_columns)
    rows = ds.update(columns)
    n = rows.length
    if n == 1
      @values.merge!(rows.first)
    end
    n
  else
    super
  end
end