<% local form, viewlibrary, page_info = ... htmlviewfunctions = require("htmlviewfunctions") html = require("acf.html") %> <% local tablesortercolumns = {} if form.value.types then for i,t in ipairs(form.value.types.value) do if string.match(t, "undefined") then tablesortercolumns[#tablesortercolumns+1] = (i-1)..":{sorter: false}" end end end %> <% if form.value.result then %> <% local header_level = htmlviewfunctions.displaysectionstart(form.value.result, page_info) %> <% if #form.value.result.value == 0 then %>

No results, try adjusting query

<% else %> <% for i,name in ipairs(form.value.names.value) do %> <% end %> <% for i,row in ipairs(form.value.result.value) do %> <% for j,name in ipairs(form.value.names.value) do %> <% end %> <% end %>
<%= html.html_escape(name) %>
<%= html.html_escape(row[name]) %>
<% if viewlibrary.check_permission("downloadadhocquery") then %> <% local query = cfe({ type="hidden", value=form.value.query.value }) %> <% local viewtype = cfe({ type="hidden", value="stream" }) %> <% htmlviewfunctions.displayitem(cfe({type="form", value={query=query, viewtype=viewtype}, label="Download query result", option="Download", action="downloadadhocquery" }), page_info, 0) %> <% end %> <% end %> <% htmlviewfunctions.displaysectionend(header_level) %> <% end %> <% local header_level = htmlviewfunctions.displaysectionstart(form, page_info) %>

This form accepts a Postgresql SELECT statement and displays the results. Examples:

The available database tables and descriptions are listed below.

<% htmlviewfunctions.displayform(form, page_info, htmlviewfunctions.incrementheader(header_level)) %> <% local header_level2 = htmlviewfunctions.displaysectionstart(cfe({label="Available Database Tables"}), page_info, htmlviewfunctions.incrementheader(header_level)) %> <% local header_level3 = htmlviewfunctions.displaysectionstart(cfe({label="pubweblog and pubweblog_history"}), page_info, htmlviewfunctions.incrementheader(header_level2)) %>

These tables contain the pre-purge and historical access logs respectively. The definition of the table is as follows:

(
    sourcename character varying(40),
    clientip inet NOT NULL,
    clientuserid character varying(64) NOT NULL,
    logdatetime timestamp(3) without time zone NOT NULL,
    uri text NOT NULL,
    bytes bigint NOT NULL,
    reason text,
    score integer,
    shortreason text,
    badyesno int,
    deniedyesno int,
    bypassyesno int,
    wordloc text,
    goodwordloc text,
    selected boolean,
    id int,
)
<% htmlviewfunctions.displaysectionend(header_level3) %> <% htmlviewfunctions.displaysectionstart(cfe({label="dbhistlog"}), page_info, header_level3) %>

This table contains the database history, including such information as which log files were loaded and how many entries they contained. The definition of the table is as follows:

(
    logdatetime timestamp(3) without time zone NOT NULL,
    msgtext text
)
<% htmlviewfunctions.displaysectionend(header_level3) %> <% htmlviewfunctions.displaysectionstart(cfe({label="source"}), page_info, header_level3) %>

This table contains the list of log file sources. The definition of the table is as follows:

(
    sourcename character varying(40) NOT NULL,
    method character varying(100) NOT NULL,
    userid character varying(32),
    passwd character varying(255),
    source character varying(255) NOT NULL,
    tzislocal boolean,
    enabled boolean
)
<% htmlviewfunctions.displaysectionend(header_level3) %> <% htmlviewfunctions.displaysectionstart(cfe({label="usagestat"}), page_info, header_level3) %>

This table contains a historical record of pages requested and blocked by hour. The definition of the table is as follows:

(
    sourcename character varying(40) NOT NULL,
    date timestamp(0) without time zone NOT NULL,
    numrequest integer,
    numblock integer
)
<% htmlviewfunctions.displaysectionend(header_level3) %> <% htmlviewfunctions.displaysectionend(header_level2) %> <% htmlviewfunctions.displaysectionend(header_level) %>