--- android/TrainInfoService/src/dk/thoerup/traininfoservice/DumpResultSet.java 2009/09/07 13:28:38 303
+++ android/TrainInfoService/src/dk/thoerup/traininfoservice/DumpResultSet.java 2009/09/08 11:51:21 304
@@ -28,6 +28,8 @@
ResultSet rs = null;
try {
+ int count = 0;
+
conn = DBConnection.getConnection();
stmt = conn.createStatement();
@@ -40,16 +42,19 @@
for (int i=1; i<=columns; i++) {
sb.append("
").append( meta.getColumnName(i)).append(" | ");
}
- sb.append("");
+ sb.append("\n\n");
while(rs.next())
{
+ count++;
+
sb.append("");
for (int i=1; i<=columns; i++) {
sb.append("").append(rs.getString(i)).append(" | ");
}
- sb.append("
");
+ sb.append("\n");
}
sb.append("");
+ sb.append("Rowcount: ").append(count);
} catch (Exception e) {
throw new ServletException(e);
} finally {
@@ -80,15 +85,21 @@
if (dump != null) {
if (dump.equals("all")) {
- res = dumpResultset("SELECT * FROM trainstations");
+ res = dumpResultset("SELECT * FROM trainstations ORDER BY id");
} else if (dump.equals("coords")) {
- res = dumpResultset("SELECT * FROM trainstations WHERE latitude IS NULL OR longitude IS NULL");
+ res = dumpResultset("SELECT * FROM trainstations WHERE latitude IS NULL OR longitude IS NULL ORDER BY id");
} else if (dump.equals("duplicate")) {
res = dumpResultset("SELECT name,count(*) FROM trainstations GROUP BY name HAVING count(*) > 1");
+ } else if (dump.equals("allfull")) {
+ res = dumpResultset("select *, " +
+ "'Maps' AS maps, " +
+ "CASE WHEN stog = false THEN 'Bane.dk' " +
+ "ELSE 'Bane.dk' " +
+ "END as banedk FROM trainstations ORDER BY id");
}
}
if (res == null) {
- res = "All
Missing coords
Duplicate stations";
+ res = "All
All with links
Missing coords
Duplicate stations";
}
resp.setContentType("text/html");