Module | Sequel::ColumnsIntrospection |
In: |
lib/sequel/extensions/columns_introspection.rb
|
Attempt to guess the columns that will be returned if there are columns selected, in order to skip a database query to retrieve the columns. This should work with Symbols, SQL::Identifiers, SQL::QualifiedIdentifiers, and SQL::AliasedExpressions.
# File lib/sequel/extensions/columns_introspection.rb, line 28 28: def columns 29: return @columns if @columns 30: return columns_without_introspection unless cols = opts[:select] and !cols.empty? 31: probable_columns = cols.map{|c| probable_column_name(c)} 32: if probable_columns.all? 33: @columns = probable_columns 34: else 35: columns_without_introspection 36: end 37: end