module Sequel::Dataset::DatasetSourceAlias

  1. lib/sequel/extensions/dataset_source_alias.rb

Methods

Public Instance

  1. from
  2. join_table

Public Instance methods

from(*source, &block)

Preprocess the list of sources and attempt to alias any datasets in the sources to the first source of the respective dataset.

[show source]
   # File lib/sequel/extensions/dataset_source_alias.rb
50 def from(*source, &block)
51   virtual_row_columns(source, block)
52   table_aliases = []
53   source = source.map do |s|
54     case s
55     when Dataset
56       s = dataset_source_alias_expression(s, table_aliases)
57     when Symbol, String, SQL::AliasedExpression, SQL::Identifier, SQL::QualifiedIdentifier
58       table_aliases << alias_symbol(s)
59     end
60     s
61   end
62   super(*source, &nil)
63 end
join_table(type, table, expr=nil, options=OPTS)

If a Dataset is given as the table argument, attempt to alias it to its source.

[show source]
   # File lib/sequel/extensions/dataset_source_alias.rb
67 def join_table(type, table, expr=nil, options=OPTS)
68   if table.is_a?(Dataset) && !options[:table_alias]
69     table = dataset_source_alias_expression(table)
70   end
71   super
72 end