pboling/rack-insight

View on GitHub
lib/rack/insight/views/panels/execute_sql.html.erb

Summary

Maintainability
Test Coverage
<a class="back" href="">&laquo;&nbsp;Back</a>

<h3>SQL Results</h3>

<dl>
  <dt>Executed SQL</dt>
  <dd><pre><%=h query.sql %></pre></dd>

  <dt>Time</dt>
  <dd><%=h "%.2f" % (query.time * 1_000) %>ms</dd>
</dl>

<table class="sortable">
  <thead>
    <tr>
      <% query.column_names.each do |field| %>
        <th><%= field.upcase %></th>
      <% end %>
    </tr>
  </thead>
  <tbody>
    <% i = 1 %>
    <% query.rows.each do |row| %>
      <tr class="<%= i % 2 == 0 ? "even" : "odd" %>">
        <% row.each do |value| %>
          <td><%= value %></td>
        <% end %>
      </tr>
      <% i += 1 %>
    <% end %>
  </tbody>
</table>