mirror of
https://github.com/fooflington/wordsearch.git
synced 2025-04-16 06:19:16 +00:00
tweaks
This commit is contained in:
parent
d6cb2c15d7
commit
e7e69263c7
11
README.md
11
README.md
@ -12,15 +12,4 @@ A simple ```Makefile``` is provided:
|
|||||||
$ make
|
$ make
|
||||||
```
|
```
|
||||||
|
|
||||||
Once built, you need to make a "war" file to deploy to your J2EE container (tested on Tomcat)
|
|
||||||
|
|
||||||
```
|
|
||||||
$ cd war && jar cfv ../wordsearch.war .
|
|
||||||
```
|
|
||||||
Then deploy your war file :-)
|
Then deploy your war file :-)
|
||||||
|
|
||||||
Alternatively you can test-run the engine...
|
|
||||||
```
|
|
||||||
$ make run <wordlist.txt
|
|
||||||
```
|
|
||||||
|
|
||||||
|
53
war/db.jsp
Normal file
53
war/db.jsp
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
<%@ page contentType="text/html" %>
|
||||||
|
<%@ page import="java.sql.*" %>
|
||||||
|
<%@ page import="org.sqlite.*" %>
|
||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<title>Database dump</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Database stats</h1>
|
||||||
|
<%
|
||||||
|
Connection conn =
|
||||||
|
DriverManager.getConnection("jdbc:sqlite:" + getServletContext().getRealPath("/WEB-INF/files/database.sqlite"));
|
||||||
|
Statement stmt = conn.createStatement();
|
||||||
|
ResultSet rs = stmt.executeQuery("select * from sqlite_master where type='table' and name='grids';");
|
||||||
|
if(rs.next()) {
|
||||||
|
// we have a row and are probably ok
|
||||||
|
} else {
|
||||||
|
// Initialise the schema
|
||||||
|
PreparedStatement pstmt = conn.prepareStatement("CREATE TABLE grids (id integer primary key, ts timestamp default current_timestamp, remotehost varchar, input, size_x int, size_y int, simple tinyint, result varchar);");
|
||||||
|
pstmt.execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
rs.close();
|
||||||
|
|
||||||
|
PreparedStatement ps_count = conn.prepareStatement("SELECT COUNT(*) FROM grids");
|
||||||
|
PreparedStatement ps_last = conn.prepareStatement("SELECT max(ts) FROM grids;");
|
||||||
|
|
||||||
|
ResultSet rs_count = ps_count.executeQuery();
|
||||||
|
ResultSet rs_last = ps_last.executeQuery();
|
||||||
|
int count = -1;
|
||||||
|
String last = "unknown";
|
||||||
|
if(rs_count.next()) {
|
||||||
|
count = rs_count.getInt(1);
|
||||||
|
}
|
||||||
|
if(rs_last.next()) {
|
||||||
|
last = rs_last.getString(1);
|
||||||
|
}
|
||||||
|
rs_count.close();
|
||||||
|
rs_last.close();
|
||||||
|
%>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Number of grids generated: <%= count %></li>
|
||||||
|
<li>Last grid generated at: <%= last %></li>
|
||||||
|
<li>Path to db: <pre><%= getServletContext().getRealPath("/WEB-INF/files/database.sqlite") %></pre></li>
|
||||||
|
</ul>
|
||||||
|
</body>
|
||||||
|
<%
|
||||||
|
conn.close();
|
||||||
|
%>
|
||||||
|
</html>
|
Loading…
x
Reference in New Issue
Block a user