Class Sequel::SQL::IrregularFunction
In: lib/sequel_core/sql.rb
Parent: Function

IrregularFunction is used for the SQL EXTRACT and CAST functions, which don‘t use regular function calling syntax. The IrregularFunction replaces the commas the regular function uses with a custom join string.

This shouldn‘t be used directly, see CastMethods#cast and ComplexExpressionMethods#extract.

Methods

new   to_s  

Attributes

arg1  [R]  The arguments to pass to the function (may be blank)
arg2  [R]  The arguments to pass to the function (may be blank)
f  [R]  The SQL function to call
joiner  [R]  The literal string to use in place of a comma to join arguments

Public Class methods

Set the attributes to the given arguments

[Source]

     # File lib/sequel_core/sql.rb, line 607
607:       def initialize(f, arg1, joiner, arg2)
608:         @f, @arg1, @joiner, @arg2 = f, arg1, joiner, arg2
609:       end

Public Instance methods

Delegate the creation of the resulting SQL to the given dataset, since it may be database dependent.

[Source]

     # File lib/sequel_core/sql.rb, line 613
613:       def to_s(ds)
614:         ds.irregular_function_sql(self)
615:       end

[Validate]