Module: Sequel::Dataset::ColumnsLimit1

Included in:
Access::DatasetMethods, Sequel::DB2::DatasetMethods, JDBC::Derby::Dataset, SqlAnywhere::DatasetMethods
Defined in:
lib/sequel/adapters/utils/columns_limit_1.rb

Constant Summary collapse

COLUMNS_CLONE_OPTIONS =
{:distinct => nil, :limit => 1, :offset=>nil, :where=>nil, :having=>nil, :order=>nil, :row_proc=>nil, :graph=>nil, :eager_graph=>nil}.freeze

Instance Method Summary collapse

Instance Method Details

#columns!Object

Use a limit of 1 instead of a limit of 0 when getting the columns.



10
11
12
13
14
15
16
17
18
19
# File 'lib/sequel/adapters/utils/columns_limit_1.rb', line 10

def columns!
  ds = clone(COLUMNS_CLONE_OPTIONS)
  ds.each{break}

  if cols = ds.cache[:_columns]
    self.columns = cols
  else
    []
  end
end