Class: ActiveRecord::ConnectionAdapters::SQLite3Adapter::ExplainPrettyPrinter

Inherits:
Object
  • Object
show all
Defined in:
lib/active_record/connection_adapters/sqlite3_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)


287
288
289
290
291
# File 'lib/active_record/connection_adapters/sqlite3_adapter.rb', line 287

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