Adds methods that allow you to treat an object as an instance of a specific ComplexExpression
subclass.
Public Instance methods
extract(datetime_part)
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
.
[show source]
# File lib/sequel/sql.rb 726 def extract(datetime_part) 727 NumericExpression.new(:extract, datetime_part, self) 728 end
sql_boolean()
Return a BooleanExpression
representation of self
.
[show source]
# File lib/sequel/sql.rb 731 def sql_boolean 732 BooleanExpression.new(:NOOP, self) 733 end
sql_number()
Return a NumericExpression
representation of self
.
~Sequel[:a] # NOT "a" ~(Sequel[:a].sql_number) # ~"a"
[show source]
# File lib/sequel/sql.rb 739 def sql_number 740 NumericExpression.new(:NOOP, self) 741 end
sql_string()
Return a StringExpression
representation of self
.
Sequel[:a] + :b # "a" + "b" Sequel[:a].sql_string + :b # "a" || "b"
[show source]
# File lib/sequel/sql.rb 747 def sql_string 748 StringExpression.new(:NOOP, self) 749 end