module Sequel::Plugins::ColumnSelect::ClassMethods

Private Instance Methods

convert_input_dataset(ds) click to toggle source

If the underlying dataset selects from a single table and has no explicit selection, explicitly select all columns from that table, qualifying them with table's name.

Calls superclass method
# File lib/sequel/plugins/column_select.rb, line 40
def convert_input_dataset(ds)
  ds = super
  if !ds.opts[:select] && (from = ds.opts[:from]) && from.length == 1 && !ds.opts[:join]
    if db.supports_schema_parsing?
      cols = check_non_connection_error{db.schema(ds)}
      if cols
        cols = cols.map{|c, _| c}
      end
    end
    cols ||= check_non_connection_error{ds.columns}
    ds = ds.select(*cols.map{|c| Sequel.qualify(ds.first_source, Sequel.identifier(c))})
  end
  ds
end