Module: Sequel::SQL::ComplexExpressionMethods

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

This module includes other Sequel::SQL::*Methods modules and is included in other classes that are could be either booleans, strings, or numbers. It also adds three methods so that can specify behavior in case one of the operator methods has been overridden (such as Symbol#/).

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) # SQL:  extract(year FROM date)

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

[Source]

         # File lib/sequel_core/sql.rb, line 343
    343:       def extract(datetime_part)
    344:         IrregularFunction.new(:extract, datetime_part.to_s.lit, :FROM, self).sql_number
    345:       end

sql_boolean()

Return a BooleanExpression representation of self.

[Source]

         # File lib/sequel_core/sql.rb, line 348
    348:       def sql_boolean
    349:         BooleanExpression.new(:NOOP, self)
    350:       end

sql_number()

Return a NumericExpression representation of self.

[Source]

         # File lib/sequel_core/sql.rb, line 353
    353:       def sql_number
    354:         NumericExpression.new(:NOOP, self)
    355:       end

sql_string()

Return a StringExpression representation of self.

[Source]

         # File lib/sequel_core/sql.rb, line 358
    358:       def sql_string
    359:         StringExpression.new(:NOOP, self)
    360:       end

[Validate]