Class Sequel::SQL::VirtualRow
In: lib/sequel_core/sql.rb
Parent: BasicObject

An instance of this class is yielded to the block supplied to filter. Useful if another library also defines the operator methods that Sequel defines for symbols.

Examples:

  ds = DB[:t]
  ds.filter{|r| r.name < 2} # SELECT * FROM t WHERE (name < 2)
  ds.filter{|r| r.table__column + 1 < 2} # SELECT * FROM t WHERE ((table.column + 1) < 2)
  ds.filter{|r| r.is_active(1, 'arg2')} # SELECT * FROM t WHERE is_active(1, 'arg2')

Methods

Public Instance methods

Can return Identifiers, QualifiedIdentifiers, or Functions:

  • Function - returned if any arguments are supplied, using the method name as the function name, and the arguments as the function arguments.
  • QualifiedIdentifier - returned if the method name contains __, with the table being the part before __, and the column being the part after.
  • Identifier - returned otherwise, using the method name.

[Source]

     # File lib/sequel_core/sql.rb, line 841
841:       def method_missing(m, *args)
842:         if args.empty?
843:           table, column = m.to_s.split('__', 2)
844:           column ? QualifiedIdentifier.new(table, column) : Identifier.new(m)
845:         else
846:           Function.new(m, *args)
847:         end
848:       end

[Validate]