| Module | Sequel::SQL::StringMethods |
| In: |
lib/sequel/extensions/escaped_like.rb
lib/sequel/sql.rb |
This module includes the like and ilike methods used for pattern matching that are defined on objects that can be used in a string context in SQL (Symbol, LiteralString, SQL::GenericExpression).
Create a EscapedLikeExpression case insensitive pattern match of the receiver with the patterns, interpolated escaped values for each +?+ placeholder in the pattern.
Sequel[:a].escaped_ilike('?%', 'A') # "a" ILIKE 'A%' ESCAPE '\'
Sequel[:a].escaped_ilike('?%', '%A') # "a" ILIKE '\%A%' ESCAPE '\'
# File lib/sequel/extensions/escaped_like.rb, line 85
85: def escaped_ilike(placeholder_pattern, placeholder_values)
86: EscapedLikeExpression.new(self, false, placeholder_pattern, placeholder_values)
87: end
Create a EscapedLikeExpression case sensitive pattern match of the receiver with the patterns, interpolated escaped values for each +?+ placeholder in the pattern.
Sequel[:a].escaped_like('?%', 'A') # "a" LIKE 'A%' ESCAPE '\'
Sequel[:a].escaped_like('?%', '%A') # "a" LIKE '\%A%' ESCAPE '\'
# File lib/sequel/extensions/escaped_like.rb, line 95
95: def escaped_like(placeholder_pattern, placeholder_values)
96: EscapedLikeExpression.new(self, true, placeholder_pattern, placeholder_values)
97: end
Create a BooleanExpression case insensitive pattern match of the receiver with the given patterns. See StringExpression.like.
Sequel[:a].ilike('A%') # "a" ILIKE 'A%' ESCAPE '\'
# File lib/sequel/sql.rb, line 933
933: def ilike(*ces)
934: StringExpression.like(self, *(ces << {:case_insensitive=>true}))
935: end
Create a BooleanExpression case sensitive (if the database supports it) pattern match of the receiver with the given patterns. See StringExpression.like.
Sequel[:a].like('A%') # "a" LIKE 'A%' ESCAPE '\'
# File lib/sequel/sql.rb, line 941
941: def like(*ces)
942: StringExpression.like(self, *ces)
943: end