Module: Sequel::ColumnsIntrospection
- Defined in:
- lib/sequel/extensions/columns_introspection.rb
Instance Method Summary collapse
-
#columns ⇒ Object
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.
Instance Method Details
#columns ⇒ Object
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.
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/sequel/extensions/columns_introspection.rb', line 20 def columns return @columns if @columns return columns_without_introspection unless cols = opts[:select] and !cols.empty? probable_columns = cols.map{|c| probable_column_name(c)} if probable_columns.all? @columns = probable_columns else columns_without_introspection end end |