class Sequel::SQL::StringExpression

in a text/string/varchar value in SQL.
Subclass of ComplexExpression where the expression results

def self.like(l, *ces)

StringExpression.like(:a, 'a%', /^a/i) # "a" LIKE 'a%' OR "a" ~* '^a'
StringExpression.like(:a, 'a%', :case_insensitive=>true) # "a" ILIKE 'a%'
StringExpression.like(:a, 'a%') # "a" LIKE 'a%'

pattern which will always be case insensitive.
if a case insensitive regular expression is used (//i), that particular
with a key of :case_insensitive that is not false or nil. Also,
The pattern match will be case insensitive if the last argument is a hash

be used, and should be supported by most databases.
If any other object is used as a regular expression, the SQL LIKE operator will

ruby regular expression verbatim as the SQL regular expression string.
advanced regular expression features. Sequel just uses the source of the
regular expression syntax, but it not exactly the same, especially for
that MySQL and PostgreSQL regular expression syntax is similar to ruby
used, which is currently only supported on MySQL and PostgreSQL. Be aware
If a regular expression is used as a pattern, an SQL regular expression will be

The match succeeds if any of the patterns match (SQL OR).
are matching against, and ces are the patterns we are matching.
Creates a SQL pattern match exprssion. left (l) is the SQL string we
def self.like(l, *ces)
  l, lre, lci = like_element(l)
  lci = (ces.last.is_a?(Hash) ? ces.pop : {})[:case_insensitive] ? true : lci
  ces.collect! do |ce|
    r, rre, rci = like_element(ce)
    BooleanExpression.new(LIKE_MAP[[lre||rre, lci||rci]], l, r)
  end
  ces.length == 1 ? ces.at(0) : BooleanExpression.new(:OR, *ces)
end

def self.like_element(re) # :nodoc:

:nodoc:
* Whether it is case insensitive
* Whether it is a regular expression
* The object to use
Returns a three element array, made up of:
def self.like_element(re) # :nodoc:
  if re.is_a?(Regexp)
    [re.source, true, re.casefold?]
  else
    [re, false, false]
  end
end

def sql_string

Return self instead of creating a new object to save on memory.
def sql_string
  self
end