<commit_before><h2>Database</h2>

<h3>Connection Configuration</h3>
<dl class="dl-horizontal">
<%- ActiveRecord::Base.connection_config.each do |key,val| -%>
  <dt><%= key %></dt><dd><%= 'password'==key.to_s ? '--FILTERED--' : val %></dd>
<%- end -%>
</dl>

<h3>Current Connection</h3>
<p>ActiveRecord::Migrator.current_version = <%= ActiveRecord::Migrator.current_version %></p>
<p>Adapter Name = <%= @conn.adapter_name %></p>
<p>Adapter Class = <%= @conn.class %></p>
<p>Connected? = <%= ActiveRecord::Base.connected? %></p>
<p>Pool size = <%= ActiveRecord::Base.connection_pool.size rescue 'N/A' %></p>
<p>Schema Cache size = <%= @conn.schema_cache.size rescue 'N/A' %></p>

<%- if defined?(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter) && @conn.class <= ActiveRecord::ConnectionAdapters::PostgreSQLAdapter -%>

<%- statement_pool = @conn.instance_variable_get(:@statements) %>
<%- if statement_pool.present? %>
  <h3>Prepared Statement Pool</h3>
    <p>Max = <%= statement_pool.instance_variable_get(:@max) %></p>
    <p>Counter = <%= statement_pool.instance_variable_get(:@counter) %></p>
    <h4>Cache</h4>
    <ol>
    <%- statement_pool.instance_variable_get(:@cache).each do |pid,cache| %>
      <li>PID: <%= pid %>
        <ol>
          <%- cache.each do |k,v| %>
            <li><%= v %> = <%= k %></li>
          <%- end %>
        </ol>
      </li>
    <%- end %>
    </ol>
<%- end %>
<commit_msg>show prepared statements for current connection for postgres<commit_after><h2>Database</h2>

<h3>Connection Configuration</h3>
<dl class="dl-horizontal">
<%- ActiveRecord::Base.connection_config.each do |key,val| -%>
  <dt><%= key %></dt><dd><%= 'password'==key.to_s ? '--FILTERED--' : val %></dd>
<%- end -%>
</dl>

<h3>Current Connection</h3>
<p>ActiveRecord::Migrator.current_version = <%= ActiveRecord::Migrator.current_version %></p>
<p>Adapter Name = <%= @conn.adapter_name %></p>
<p>Adapter Class = <%= @conn.class %></p>
<p>Connected? = <%= ActiveRecord::Base.connected? %></p>
<p>Pool size = <%= ActiveRecord::Base.connection_pool.size rescue 'N/A' %></p>
<p>Schema Cache size = <%= @conn.schema_cache.size rescue 'N/A' %></p>

<%- if defined?(PG::Connection) && ActiveRecord::Base.connection.raw_connection.class <= PG::Connection -%>
  <h3>PostgreSQL Prepared Statements</h3>
  <table class="table table-condensed">
    <% statements = ActiveRecord::Base.connection.raw_connection.exec("select * from pg_prepared_statements order by prepare_time;").to_a %>
    <% statements.each do |row| %>
      <tr>
        <td><%= row["name"] %></td>
        <td><%= row["statement"] %></td>
      </tr>
    <% end %>
  </table>
<% end %>

<%- if defined?(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter) && @conn.class <= ActiveRecord::ConnectionAdapters::PostgreSQLAdapter -%>

<%- statement_pool = @conn.instance_variable_get(:@statements) %>
<%- if statement_pool.present? %>
  <h3>Prepared Statement Pool</h3>
    <p>Max = <%= statement_pool.instance_variable_get(:@max) %></p>
    <p>Counter = <%= statement_pool.instance_variable_get(:@counter) %></p>
    <h4>Cache</h4>
    <ol>
    <%- statement_pool.instance_variable_get(:@cache).each do |pid,cache| %>
      <li>PID: <%= pid %>
        <ol>
          <%- cache.each do |k,v| %>
            <li><%= v %> = <%= k %></li>
          <%- end %>
        </ol>
      </li>
    <%- end %>
    </ol>
<%- end %>

{'fraction_non_alphanumeric': 0.2259970457902511, 'fraction_numerical': 0.006499261447562777, 'mean_word_length': 3.921511627906977, 'pattern_counts': {'":': 0, '<': 149, '<?xml version=': 0, '>': 146, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3856298', 'n_tokens_mistral': 1294, 'n_tokens_neox': 1191, 'n_words': 206}