Method: Sequel::SQLite::DatasetMethods#explain

Defined in:
lib/sequel/adapters/shared/sqlite.rb

#explain(opts = nil) ⇒ Object

Return an array of strings specifying a query explanation for a SELECT of the current dataset. Currently, the options are ignored, but it accepts options to be compatible with other adapters.



683
684
685
686
687
688
689
690
# File 'lib/sequel/adapters/shared/sqlite.rb', line 683

def explain(opts=nil)
  # Load the PrettyTable class, needed for explain output
  Sequel.extension(:_pretty_table) unless defined?(Sequel::PrettyTable)

  ds = db.send(:metadata_dataset).clone(:sql=>"EXPLAIN #{select_sql}")
  rows = ds.all
  Sequel::PrettyTable.string(rows, ds.columns)
end