module Sequel::Plugins::PgXminOptimisticLocking::InstanceMethods
Private Instance Methods
Source
# File lib/sequel/plugins/pg_xmin_optimistic_locking.rb 87 def _insert_dataset 88 super.returning(WILDCARD, :xmin) 89 end
Include xmin value when inserting initial row
Calls superclass method
Source
# File lib/sequel/plugins/pg_xmin_optimistic_locking.rb 93 def _save_update_all_columns_hash 94 v = super 95 v.delete(:xmin) 96 v 97 end
Remove the xmin from the columns to update. PostgreSQL automatically updates the xmin value, and it cannot be assigned.
Calls superclass method
Source
# File lib/sequel/plugins/pg_xmin_optimistic_locking.rb 100 def _update_without_checking(columns) 101 ds = _update_dataset 102 rows = ds.clone(ds.send(:default_server_opts, :sql=>ds.returning(:xmin).update_sql(columns))).all 103 values[:xmin] = rows.first[:xmin] unless rows.empty? 104 rows.length 105 end
Add an RETURNING clause to fetch the updated xmin when updating the row.
Source
# File lib/sequel/plugins/pg_xmin_optimistic_locking.rb 82 def lock_column_instance_filter 83 super if @values[:xmin] 84 end
Only set the lock column instance filter if there is an xmin value.
Calls superclass method