Class: Rack::Bug::SQLPanel::PanelApp

Inherits:
PanelApp
  • Object
show all
Defined in:
lib/rack/bug/panels/sql_panel/panel_app.rb

Instance Attribute Summary

Attributes inherited from PanelApp

#request

Instance Method Summary collapse

Methods inherited from PanelApp

#call, #not_found, #params, #render_template, #validate_params

Methods included from Render

#compile, #compile!, #compiled_source, #method_name, #method_name_without_locals, #render_template, #signed_params

Instance Method Details

#dispatchObject



7
8
9
10
11
12
13
14
# File 'lib/rack/bug/panels/sql_panel/panel_app.rb', line 7

def dispatch
  case request.path_info
  when "/__rack_bug__/explain_sql" then explain_sql
  when "/__rack_bug__/profile_sql" then profile_sql
  when "/__rack_bug__/execute_sql" then execute_sql
  else not_found
  end
end

#execute_sqlObject



28
29
30
31
32
# File 'lib/rack/bug/panels/sql_panel/panel_app.rb', line 28

def execute_sql
  validate_params
  query = Query.new(params["query"], params["time"].to_f)
  render_template "panels/execute_sql", :result => query.execute, :query => query.sql, :time => query.time
end

#explain_sqlObject



16
17
18
19
20
# File 'lib/rack/bug/panels/sql_panel/panel_app.rb', line 16

def explain_sql
  validate_params
  query = Query.new(params["query"], params["time"].to_f)
  render_template "panels/explain_sql", :result => query.explain, :query => query.sql, :time => query.time
end

#profile_sqlObject



22
23
24
25
26
# File 'lib/rack/bug/panels/sql_panel/panel_app.rb', line 22

def profile_sql
  validate_params
  query = Query.new(params["query"], params["time"].to_f)
  render_template "panels/profile_sql", :result => query.profile, :query => query.sql, :time => query.time
end