| 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 41
41: def with_pk(pk)
42: begin
43: ds, bv = unbind
44: rescue UnbindDuplicate
45: super
46: else
47: begin
48: bv = bv.merge!(model.primary_key_hash(pk)){|k, v1, v2| ((v1 == v2) ? v1 : raise(UnbindDuplicate))}
49: rescue UnbindDuplicate
50: super
51: else
52: model.send(:prepared_lookup_dataset, ds).call(bv)
53: end
54: end
55: end