From: Natasha Sherstneva Date: Fri, 8 Nov 2013 15:03:49 +0000 (+0000) Subject: new type date request X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=642acd8e446f4ec6765eded00dabd01649e39830;p=proteocache.git new type date request --- diff --git a/datadb/compbio/cassandra/CassandraNativeConnector.java b/datadb/compbio/cassandra/CassandraNativeConnector.java index 6e6992d..8e76d43 100644 --- a/datadb/compbio/cassandra/CassandraNativeConnector.java +++ b/datadb/compbio/cassandra/CassandraNativeConnector.java @@ -228,17 +228,16 @@ public class CassandraNativeConnector { */ public Integer ReadDateTable(long queryDate) { final long startTime = System.currentTimeMillis(); - String com = "SELECT jobtime, JobID FROM ProteinData WHERE jobtime = " + queryDate + ";"; + String com = "SELECT count(*) FROM ProteinData WHERE jobtime = " + queryDate + ";"; System.out.println("Command: " + com); ResultSet results = session.execute(com); final long queryTime = System.currentTimeMillis(); System.out.println("Query time is " + (queryTime - startTime) + " msec"); - if (results.isExhausted()) - return 0; - List rows = results.all(); + Row row = results.one(); + Integer count = (int) row.getLong(0); final long endTime = System.currentTimeMillis(); - System.out.println("Processing time is " + (endTime - queryTime) + " msec"); - return rows.size(); + System.out.println("Processing time is " + (endTime - queryTime) + " msec"); + return count; } /* diff --git a/server/compbio/statistic/CassandraRequester.java b/server/compbio/statistic/CassandraRequester.java index 5682cdb..92ca531 100755 --- a/server/compbio/statistic/CassandraRequester.java +++ b/server/compbio/statistic/CassandraRequester.java @@ -141,6 +141,7 @@ public class CassandraRequester { query = new ArrayList(); for (Date date = start.getTime(); !start.after(end); start.add(Calendar.DATE, 1), date = start.getTime()) { Integer res = DBInstance.ReadDateTable(date.getTime()); + System.out.println("Command: " + res); if (res == null) continue; DataBase db = new DataBase();