module Sequel::Dataset::ColumnsLimit1

  1. lib/sequel/adapters/utils/columns_limit_1.rb

Methods

Public Instance

  1. columns!

Constants

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

Public Instance methods

columns!()

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

[show source]
   # File lib/sequel/adapters/utils/columns_limit_1.rb
10 def columns!
11   ds = clone(COLUMNS_CLONE_OPTIONS)
12   ds.each{break}
13 
14   if cols = ds.cache[:_columns]
15     self.columns = cols
16   else
17     []
18   end
19 end