Module | Sequel::Plugins::PreparedStatementsWithPk::DatasetMethods |
In: |
lib/sequel/plugins/prepared_statements_with_pk.rb
|
Use a prepared statement to find a row with the matching primary key inside this dataset.
# File lib/sequel/plugins/prepared_statements_with_pk.rb, line 43 43: def with_pk(pk) 44: begin 45: ds, bv = unbind 46: rescue UnbindDuplicate 47: super 48: else 49: begin 50: bv = bv.merge!(model.primary_key_hash(pk)){|k, v1, v2| ((v1 == v2) ? v1 : raise(UnbindDuplicate))} 51: rescue UnbindDuplicate 52: super 53: else 54: model.send(:prepared_lookup_dataset, ds).call(bv) 55: end 56: end 57: end