From: Sasha Sherstnev Date: Tue, 12 Nov 2013 15:22:07 +0000 (+0000) Subject: Fix bug for inserting job without known predictions X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=b5adc8392eb68caf1c1b929cbeb86d09adc1ad28;p=proteocache.git Fix bug for inserting job without known predictions --- diff --git a/datadb/compbio/cassandra/CassandraWriter.java b/datadb/compbio/cassandra/CassandraWriter.java index 6ee62fd..c478d68 100644 --- a/datadb/compbio/cassandra/CassandraWriter.java +++ b/datadb/compbio/cassandra/CassandraWriter.java @@ -67,7 +67,7 @@ public class CassandraWriter { allpredictions += "'" + predictionname + "':'" + prediction + "',"; } String final_prediction = ""; - if (null != allpredictions) { + if (!allpredictions.equals("")) { final_prediction = allpredictions.substring(0, allpredictions.length() - 1); } @@ -79,7 +79,7 @@ public class CassandraWriter { session.execute(com3); } - // update some internal tables + // update some internal query tables String check3 = "SELECT * FROM MainParameters WHERE Name = 'EarliestJobDate';"; ResultSet results3 = session.execute(check3); boolean updateparameter = true; @@ -93,15 +93,15 @@ public class CassandraWriter { + "');"; session.execute(com); } - String check4 = "SELECT * FROM MainParameters WHERE Name = 'TotalNumberOfJobs';"; + String check4 = "SELECT * FROM JobDateInfo WHERE jobday = " + jobtime + ";"; ResultSet results4 = session.execute(check4); updateparameter = true; int njobs = 1; if (!results4.isExhausted()) { Row r = results4.one(); - njobs += Integer.parseInt(r.getString("Value")); + njobs += r.getLong("Total"); } - String com = "INSERT INTO MainParameters " + "(Name, Value)" + " VALUES ('TotalNumberOfJobs','" + String.valueOf(njobs) + "');"; + String com = "INSERT INTO JobDateInfo " + "(jobday, Total)" + " VALUES (" + jobtime + "," + njobs + ");"; session.execute(com); return 1;