This module includes the standard mathematical methods (+, -, *, and /)
that are defined on objects that can be used in a numeric context in SQL (
LiteralString, and +SQL::GenericExpression+).
:a + :b # "a" + "b" :a - :b # "a" - "b" :a * :b # "a" * "b" :a / :b # "a" / "b"
One exception to this is if + is called with a
StringExpression, in which case the || operator is used
instead of the + operator:
:a + 'b' # "a" || 'b'
Public Instance methods
# File lib/sequel/sql.rb, line 760 def +(ce) case ce when LiteralString NumericExpression.new(:+, self, ce) when StringExpression, String StringExpression.new(:'||', self, ce) else NumericExpression.new(:+, self, ce) end end