diff --git a/README.md b/README.md index 9439e62..84e004f 100755 --- a/README.md +++ b/README.md @@ -12,15 +12,4 @@ A simple ```Makefile``` is provided: $ 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 :-) - -Alternatively you can test-run the engine... -``` -$ make run +<%@ page import="java.sql.*" %> +<%@ page import="org.sqlite.*" %> + + + + + Database dump + + +

Database stats

+ <% + 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(); + %> + + + + <% + conn.close(); + %> + \ No newline at end of file