Module | Sequel::SQL::ComplexExpressionMethods
In: | lib/sequel/sql.rb

Adds methods that allow you to treat an object as an instance of a specific `ComplexExpression` subclass. This is useful if another library overrides the methods defined by Sequel.

For example, if `Symbol#/` is overridden to produce a string (for example, to make file system path creation easier), the following code will not do what you want:

      :price/10 > 100

In that case, you need to do the following:

      :price.sql_number/10 > 100

### Methods

extract sql_boolean sql_number sql_string

### Public Instance methods

extract(datetime_part)

Extract a datetime part (e.g. year, month) from self:

      :date.extract(:year) # extract(year FROM "date")

Also has the benefit of returning the result as a NumericExpression instead of a generic ComplexExpression.

[Source]

         # File lib/sequel/sql.rb, line 638
    638:       def extract(datetime_part)
    639:         NumericExpression.new(:extract, datetime_part, self)
    640:       end

sql_boolean()

Return a BooleanExpression representation of `self`.

[Source]

         # File lib/sequel/sql.rb, line 643
    643:       def sql_boolean
    644:         BooleanExpression.new(:NOOP, self)
    645:       end

sql_number()

Return a NumericExpression representation of `self`.

      ~:a # NOT "a"
      ~:a.sql_number # ~"a"

[Source]

         # File lib/sequel/sql.rb, line 651
    651:       def sql_number
    652:         NumericExpression.new(:NOOP, self)
    653:       end

sql_string()

Return a StringExpression representation of `self`.

      :a + :b # "a" + "b"
      :a.sql_string + :b # "a" || "b"

[Source]

         # File lib/sequel/sql.rb, line 659
    659:       def sql_string
    660:         StringExpression.new(:NOOP, self)
    661:       end

[Validate]