Files

SQLConstructor::BasicJoin

Internal class which represents a basic JOIN statement.

Constants

METHODS

Attributes

join_on[RW]
join_sources[RW]
join_using[RW]

Public Class Methods

new( _caller, type, *sources ) click to toggle source

Class contructor. Takes a caller object as the first argument, JOIN type as the second argument, and a list of sources for the JOIN clause

# File lib/sqlconstructor.rb, line 446
def initialize ( _caller, type, *sources )
    type = type.to_s
    type.upcase!.gsub! /_/, ' '
    super _caller
    @type = type
    @join_sources = SQLAliasedList.new *sources
end

Public Instance Methods

join_more( *sources ) click to toggle source

Adds more sources to @join_sources list

# File lib/sqlconstructor.rb, line 457
def join_more ( *sources )
    @join_sources.push *sources
end
to_s() click to toggle source

Export to string with sources aliases

# File lib/sqlconstructor.rb, line 464
def to_s
    return @string  if @string
    result  = @type + " "
    arr = [ ]
    @join_sources.each do |src|
        _alias = src.alias ? " " + src.alias.to_s : ""
        str = src.to_s + _alias
        arr << str
    end
    result += arr.join ','
    result += @exporter.separator
    result += "ON " + @join_on.val.to_s  if @join_on
    @string = result
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.