Method: Sequel::Dataset#lock_style
- Defined in:
- lib/sequel/dataset/query.rb
#lock_style(style) ⇒ Object
Returns a cloned dataset with the given lock style. If style is a string, it will be used directly. You should never pass a string to this method that is derived from user input, as that can lead to SQL injection.
A symbol may be used for database independent locking behavior, but all supported symbols have separate methods (e.g. for_update).
DB[:items].lock_style('FOR SHARE NOWAIT')
# SELECT * FROM items FOR SHARE NOWAIT
DB[:items].lock_style('FOR UPDATE OF table1 SKIP LOCKED')
# SELECT * FROM items FOR UPDATE OF table1 SKIP LOCKED
689 690 691 |
# File 'lib/sequel/dataset/query.rb', line 689 def lock_style(style) clone(:lock => style) end |