Method: Sequel::MySQL::Dataset#join_table
- Defined in:
- lib/sequel_core/adapters/mysql.rb
#join_table(type, table, expr = nil, table_alias = nil) ⇒ Object
Returns a join clause based on the specified join type and condition. MySQL’s NATURAL join is ‘semantically equivalent to a JOIN with a USING clause that names all columns that exist in both tables. The constraint expression may be nil, so join expression can accept two arguments.
Note
Full outer joins (:full_outer) are not implemented in MySQL (as of v6.0), nor is there currently a work around implementation in Sequel. Straight joins with ‘ON <condition>’ are not yet implemented.
Example
@ds = MYSQL_DB[:nodes]
@ds.join_table(:natural_left_outer, :nodes)
# join SQL is 'NATURAL LEFT OUTER JOIN nodes'
320 321 322 323 324 |
# File 'lib/sequel_core/adapters/mysql.rb', line 320 def join_table(type, table, expr=nil, table_alias=nil) type = :inner if (type == :cross) && !expr.nil? raise(Sequel::Error::InvalidJoinType, "MySQL doesn't support FULL OUTER JOIN") if type == :full_outer super(type, table, expr, table_alias) end |