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
48 def _save_update_all_columns_hash
49   v = super
50   v.delete(model.lock_column)
51   v
52 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
55 def _update_without_checking(columns)
56   ds = _update_dataset
57   lc = model.lock_column
58   rows = ds.clone(ds.send(:default_server_opts, :sql=>ds.output(nil, [Sequel[:inserted][lc]]).update_sql(columns))).all
59   values[lc] = rows.first[lc] unless rows.empty?
60   rows.length
61 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
41 def lock_column_instance_filter_value
42   Sequel.blob(super)
43 end