module Sequel::Plugins::PgXminOptimisticLocking::ClassMethods

Private Instance Methods

append_xmin_column_if_usable(ds) click to toggle source

If the xmin column is not already selected, and selecting it does not raise an error, append it to the selections.

   # File lib/sequel/plugins/pg_xmin_optimistic_locking.rb
67 def append_xmin_column_if_usable(ds)
68   select = ds.opts[:select]
69 
70   unless select && select.include?(:xmin)
71     xmin_ds = ds.select_append(:xmin)
72     begin
73       columns = xmin_ds.columns!
74     rescue Sequel::DatabaseConnectionError, Sequel::DatabaseDisconnectError
75       raise
76     rescue Sequel::DatabaseError
77       # ignore, could be view, subquery, table returning function, etc.
78     else
79       ds = xmin_ds if columns.include?(:xmin)
80     end
81   end
82 
83   ds
84 end
convert_input_dataset(ds) click to toggle source

Ensure the dataset selects the xmin column if doing so

Calls superclass method
   # File lib/sequel/plugins/pg_xmin_optimistic_locking.rb
61 def convert_input_dataset(ds)
62   append_xmin_column_if_usable(super)
63 end