module Sequel::Plugins::PreparedStatementsWithPk::DatasetMethods

Public Instance Methods

with_pk(pk) click to toggle source

Use a prepared statement to find a row with the matching primary key inside this dataset.

Calls superclass method
# File lib/sequel/plugins/prepared_statements_with_pk.rb, line 41
def with_pk(pk)
  begin
    ds, bv = unbind
  rescue UnbindDuplicate
    super
  else
    begin
      bv = bv.merge!(model.primary_key_hash(pk)){|k, v1, v2| ((v1 == v2) ? v1 : raise(UnbindDuplicate))}
    rescue UnbindDuplicate
      super
    else
      model.send(:prepared_lookup_dataset, ds).call(bv)
    end
  end
end