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
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.
# File lib/sequel/sql.rb, line 623 623: def extract(datetime_part) 624: NumericExpression.new(:extract, datetime_part, self) 625: end
Return a BooleanExpression representation of self.
# File lib/sequel/sql.rb, line 628 628: def sql_boolean 629: BooleanExpression.new(:NOOP, self) 630: end
Return a NumericExpression representation of self.
~:a # NOT "a" ~:a.sql_number # ~"a"
# File lib/sequel/sql.rb, line 636 636: def sql_number 637: NumericExpression.new(:NOOP, self) 638: end
Return a StringExpression representation of self.
:a + :b # "a" + "b" :a.sql_string + :b # "a" || "b"
# File lib/sequel/sql.rb, line 644 644: def sql_string 645: StringExpression.new(:NOOP, self) 646: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.