Class: ActiveRecord::ConnectionAdapters::SQLiteAdapter::ExplainPrettyPrinter

Inherits:
Object
  • Object
show all
Defined in:
lib/active_record/connection_adapters/sqlite_adapter.rb

Instance Method Summary collapse

Instance Method Details

#pp(result) ⇒ Object

Pretty prints the result of a EXPLAIN QUERY PLAN in a way that resembles the output of the SQLite shell:

0|0|0|SEARCH TABLE users USING INTEGER PRIMARY KEY (rowid=?) (~1 rows)
0|1|1|SCAN TABLE posts (~100000 rows)


234
235
236
237
238
# File 'lib/active_record/connection_adapters/sqlite_adapter.rb', line 234

def pp(result) # :nodoc:
  result.rows.map do |row|
    row.join('|')
  end.join("\n") + "\n"
end