dump database

This commit is contained in:
Matthew Slowe 2020-05-29 13:50:59 +01:00
parent f2264d03c3
commit 4043fbd1e6

50
war/dump.jsp Normal file
View File

@ -0,0 +1,50 @@
<%@ page contentType="text/html" %>
<%@ page import="java.sql.*" %>
<%@ page import="org.sqlite.*" %>
<!DOCTYPE html>
<html lang="en">
<head>
<title>SQLite Demo</title>
</head>
<body>
<table border="1">
<thead>
<th>id</th>
<th>timestamp</th>
<th>remotehost</th>
<th>input</th>
<th>size_x</th>
<th>size_y</th>
<th>simple</th>
<th>result</th>
</thead>
<tbody>
<%
Connection conn =
DriverManager.getConnection("jdbc:sqlite:" + getServletContext().getInitParameter("sqlite_db"));
Statement stat = conn.createStatement();
ResultSet rs = stat.executeQuery("select * from grids;");
while (rs.next()) {
out.println("<tr>");
out.println("<td>" + rs.getString("id") + "</td>");
out.println("<td>" + rs.getString("ts") + "</td>");
out.println("<td>" + rs.getString("remotehost") + "</td>");
out.println("<td><pre>" + rs.getString("input") + "</pre></td>");
out.println("<td>" + rs.getInt("size_x") + "</td>");
out.println("<td>" + rs.getInt("size_y") + "</td>");
out.println("<td>" + rs.getInt("simple") + "</td>");
out.println("<td><pre>" + rs.getString("result") + "</pre></td>");
out.println("</tr>");
}
rs.close();
conn.close();
%>
</tbody>
</table>
</body>
</html>