| Module | Sequel::Dataset::DatasetSourceAlias |
| In: |
lib/sequel/extensions/dataset_source_alias.rb
|
Preprocess the list of sources and attempt to alias any datasets in the sources to the first source of the respective dataset.
# File lib/sequel/extensions/dataset_source_alias.rb, line 50
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
If a Dataset is given as the table argument, attempt to alias it to its source.
# File lib/sequel/extensions/dataset_source_alias.rb, line 67
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