Module: Sequel::SQL::StringMethods
- Included in:
- Dataset, LiteralString, GenericExpression, StringAgg, StringExpression, Symbol
- Defined in:
- lib/sequel/sql.rb,
lib/sequel/extensions/escaped_like.rb
Overview
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
).
Instance Method Summary collapse
-
#escaped_ilike(placeholder_pattern, placeholder_values) ⇒ Object
Create a
EscapedLikeExpression
case insensitive pattern match of the receiver with the patterns, interpolated escaped values for each ? placeholder in the pattern. -
#escaped_like(placeholder_pattern, placeholder_values) ⇒ Object
Create a
EscapedLikeExpression
case sensitive pattern match of the receiver with the patterns, interpolated escaped values for each ? placeholder in the pattern. -
#ilike(*ces) ⇒ Object
Create a
BooleanExpression
case insensitive pattern match of the receiver with the given patterns. -
#like(*ces) ⇒ Object
Create a
BooleanExpression
case sensitive (if the database supports it) pattern match of the receiver with the given patterns.
Instance Method Details
#escaped_ilike(placeholder_pattern, placeholder_values) ⇒ Object
85 86 87 |
# File 'lib/sequel/extensions/escaped_like.rb', line 85 def escaped_ilike(placeholder_pattern, placeholder_values) EscapedLikeExpression.new(self, false, placeholder_pattern, placeholder_values) end |
#escaped_like(placeholder_pattern, placeholder_values) ⇒ Object
95 96 97 |
# File 'lib/sequel/extensions/escaped_like.rb', line 95 def escaped_like(placeholder_pattern, placeholder_values) EscapedLikeExpression.new(self, true, placeholder_pattern, placeholder_values) end |
#ilike(*ces) ⇒ Object
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 '\'
958 959 960 |
# File 'lib/sequel/sql.rb', line 958 def ilike(*ces) StringExpression.like(self, *(ces << {:case_insensitive=>true})) end |
#like(*ces) ⇒ Object
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 '\'
966 967 968 |
# File 'lib/sequel/sql.rb', line 966 def like(*ces) StringExpression.like(self, *ces) end |