{% extends "base_tables.html" %}

{% block content_title %}{{ dataset.base_name }}{% endblock %}

{% block content %}
  <table class="table table-striped">
    <tbody>
      <tr>
        <th>Sqlite</th>
        <td>{{ sqlite.sqlite_version }}</td>
      </tr>
      <tr>
        <th>Filename</th>
        <td>{{ dataset.filename }}
          {% if dataset.is_readonly %}<strong>read-only</strong>{% endif %}
        </td>
      </tr>
      <tr>
        <th>Size</th>
        <td>{{ dataset.size_on_disk|filesizeformat }}</td>
      </tr>
      <tr>
        <th>Created</th>
        <td>{{ dataset.created.strftime('%A %B %d, %Y at %I:%M:%p') }}</td>
      </tr>
      <tr>
        <th>Modified</th>
        <td>{{ dataset.modified.strftime('%A %B %d, %Y at %I:%M:%p') }}</td>
      </tr>
      <tr>
        <th>Tables</th>
        <td>{{ dataset.tables|length }}</td>
      </tr>
      <tr>
        <th>Indexes</th>
        <td>{{ dataset.get_all_indexes()|length }}</td>
      </tr>
      <tr>
        <th>Triggers</th>
        <td>{{ dataset.get_all_triggers()|length }}</td>
      </tr>
      <tr>
        <th>Views</th>
        <td>{{ dataset.get_all_views()|length }}</td>
      </tr>
    </tbody>
  </table>
  <hr />
  <h3>Query</h3>
  <form action="{{ url_for('generic_query') }}" method="post" role="form">
    <div class="form-group">
      <textarea class="form-control" name="sql" placeholder="Execute SQL query..." style="height: 120px;"></textarea>
    </div>
    <button class="btn btn-primary" type="submit">Execute</button>
  </form>
{% endblock %}
