Class: Sequel::SQL::JoinClause

Inherits:
SpecificExpression show all
Defined in:
lib/sequel_core/sql.rb

Overview

Represents an SQL JOIN clause, used for joining tables.

Direct Known Subclasses

JoinOnClause, JoinUsingClause

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Expression

#lit

Constructor Details

#initialize(join_type, table, table_alias = nil) ⇒ JoinClause

Create an object with the given conditions and default value.



610
611
612
# File 'lib/sequel_core/sql.rb', line 610

def initialize(join_type, table, table_alias = nil)
  @join_type, @table, @table_alias = join_type, table, table_alias
end

Instance Attribute Details

#join_typeObject (readonly)

The type of join to do



600
601
602
# File 'lib/sequel_core/sql.rb', line 600

def join_type
  @join_type
end

#tableObject (readonly)

The actual table to join



603
604
605
# File 'lib/sequel_core/sql.rb', line 603

def table
  @table
end

#table_aliasObject (readonly)

The table alias to use for the join, if any



606
607
608
# File 'lib/sequel_core/sql.rb', line 606

def table_alias
  @table_alias
end

Instance Method Details

#to_s(ds) ⇒ Object

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



616
617
618
# File 'lib/sequel_core/sql.rb', line 616

def to_s(ds)
  ds.join_clause_sql(self)
end