Method: ROM::SQL::Relation::Reading#lock
- Defined in:
- lib/rom/sql/relation/reading.rb
#lock(options) ⇒ SQL::Relation #lock(options) {|relation| ... } ⇒ Object
Lock rows with in the specified mode. Check out ROW_LOCK_MODES for the list of supported modes, keep in mind available lock modes heavily depend on the database type+version you’re running on.
913 914 915 916 917 918 919 920 921 922 923 |
# File 'lib/rom/sql/relation/reading.rb', line 913 def lock(**, &) clause = lock_clause(**) if block_given? transaction do yield(dataset.lock_style(clause).to_a) end else new(dataset.lock_style(clause)) end end |