add_lock!(sql, options)
public
Appends a locking clause to an SQL statement. This method modifies
the sql parameter.
add_lock! 'SELECT * FROM suppliers', :lock => true
add_lock! 'SELECT * FROM suppliers', :lock => ' FOR UPDATE'
Show source
def add_lock!(sql, options)
case lock = options[:lock]
when true; sql << ' FOR UPDATE'
when String; sql << " #{lock}"
end
end