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

Public Instance methods

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.

The extract function is in the SQL standard, but it doesn‘t doesn‘t use the standard function calling convention.

[Source]

     # File lib/sequel/sql.rb, line 226
226:       def extract(datetime_part)
227:         Function.new(:extract, PlaceholderLiteralString.new("#{datetime_part} FROM ?", [self])).sql_number
228:       end

Return a BooleanExpression representation of self.

[Source]

     # File lib/sequel/sql.rb, line 231
231:       def sql_boolean
232:         BooleanExpression.new(:NOOP, self)
233:       end

Return a NumericExpression representation of self.

[Source]

     # File lib/sequel/sql.rb, line 236
236:       def sql_number
237:         NumericExpression.new(:NOOP, self)
238:       end

Return a StringExpression representation of self.

[Source]

     # File lib/sequel/sql.rb, line 241
241:       def sql_string
242:         StringExpression.new(:NOOP, self)
243:       end

[Validate]