module Sequel::Plugins::MssqlOptimisticLocking::InstanceMethods

Private Instance Methods

_save_update_all_columns_hash() click to toggle source

Remove the lock column from the columns to update. SQL Server automatically updates the lock column value, and does not like it to be assigned.

Calls superclass method
# File lib/sequel/plugins/mssql_optimistic_locking.rb, line 47
def _save_update_all_columns_hash
  v = super
  v.delete(model.lock_column)
  v
end
_update_without_checking(columns) click to toggle source

Add an OUTPUT clause to fetch the updated timestamp when updating the row.

# File lib/sequel/plugins/mssql_optimistic_locking.rb, line 54
def _update_without_checking(columns)
  ds = _update_dataset
  lc = model.lock_column
  rows = ds.clone(ds.send(:default_server_opts, :sql=>ds.output(nil, [Sequel[:inserted][lc]]).update_sql(columns))).all
  values[lc] = rows.first[lc] unless rows.empty?
  rows.length
end
lock_column_instance_filter_value() click to toggle source

Make the instance filter value a blob.

Calls superclass method
# File lib/sequel/plugins/mssql_optimistic_locking.rb, line 40
def lock_column_instance_filter_value
  Sequel.blob(super)
end