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.

Methods

Public Instance methods

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

  Sequel[: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 705
705:       def extract(datetime_part)
706:         NumericExpression.new(:extract, datetime_part, self)
707:       end

Return a BooleanExpression representation of self.

[Source]

     # File lib/sequel/sql.rb, line 710
710:       def sql_boolean
711:         BooleanExpression.new(:NOOP, self)
712:       end

Return a NumericExpression representation of self.

  ~Sequel[:a] # NOT "a"
  ~(Sequel[:a].sql_number) # ~"a"

[Source]

     # File lib/sequel/sql.rb, line 718
718:       def sql_number
719:         NumericExpression.new(:NOOP, self)
720:       end

Return a StringExpression representation of self.

  Sequel[:a] + :b # "a" + "b"
  Sequel[:a].sql_string + :b # "a" || "b"

[Source]

     # File lib/sequel/sql.rb, line 726
726:       def sql_string
727:         StringExpression.new(:NOOP, self)
728:       end

[Validate]