| Path: | lib/sequel/extensions/escaped_like.rb |
| Last Update: | Sat Jun 02 02:04:22 +0000 2018 |
frozen-string-literal: true
The escaped_like extension adds escaped_like and escaped_ilike methods to Sequel::SQL::StringMethods, which allow them to be easily used with most of Sequel‘s expression objects. Example:
DB[:table].where{string_column.escaped_like('?%', user_input)}
# user_input is 'foo':
# SELECT * FROM table WHERE string_column LIKE 'foo%' ESCAPE '\'
# user_input is '%foo':
# SELECT * FROM table WHERE string_column LIKE '\%foo%' ESCAPE '\'
To load the extension:
Sequel.extension :escaped_like
Related modules: Sequel::SQL::StringMethods, Sequel::SQL::EscapedLikeExpression