Module Sequel::SQL::NumericMethods
In: lib/sequel/sql.rb

This module includes the standard mathematical methods (+, -, *, and /) that are defined on objects that can be used in a numeric context in SQL (Symbol, 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 String or StringExpression, in which case the || operator is used instead of the + operator:

  :a + 'b' # "a" || 'b'

Methods

+  

Public Instance methods

Use || as the operator when called with StringExpression and String instances, and the + operator for LiteralStrings and all other types.

[Source]

     # File lib/sequel/sql.rb, line 770
770:       def +(ce)
771:         case ce
772:         when LiteralString
773:           NumericExpression.new(:+, self, ce)
774:         when StringExpression, String
775:           StringExpression.new('||''||', self, ce)
776:         else
777:           NumericExpression.new(:+, self, ce)
778:         end
779:       end

[Validate]