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
57 def _save_update_all_columns_hash
58   v = super
59   v.delete(model.lock_column)
60   v
61 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
64 def _update_without_checking(columns)
65   ds = _update_dataset
66   lc = model.lock_column
67   rows = ds.clone(ds.send(:default_server_opts, :sql=>ds.output(nil, [Sequel[:inserted][lc]]).update_sql(columns).freeze)).all
68   values[lc] = rows.first[lc] unless rows.empty?
69   rows.length
70 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
50 def lock_column_instance_filter_value
51   Sequel.blob(super)
52 end