Skip to content

Commit

Permalink
do not add fix variable to teh select statement twice
Browse files Browse the repository at this point in the history
  • Loading branch information
TatianaBurek committed May 9, 2019
1 parent 5ca8203 commit 5f20cf4
Showing 1 changed file with 23 additions and 10 deletions.
33 changes: 23 additions & 10 deletions java/edu/ucar/metviewer/db/mysql/MysqlAppDatabaseManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -1049,11 +1049,16 @@ public List<String> buildPlotSql(
if (listPlotFixVal.length > 0) {
for (int i = 0; i < listPlotFixVal.length; i++) {
String strField = (String) listPlotFixVal[i].getKey();
String fieldFormatted = formatField(strField, job.isModeJob() || job.isMtdJob(), true);
if (listPlotFixVal[i].getValue() != null) {
selectList += ",\n "
+ formatField(strField, job.isModeJob() || job.isMtdJob(), true);
selectPlotList += ",\n "
+ formatField(strField, job.isModeJob() || job.isMtdJob(), true);
if(!selectList.contains(fieldFormatted.trim())) {
selectList += ",\n "
+ formatField(strField, job.isModeJob() || job.isMtdJob(), true);
}
if(!selectPlotList.contains(fieldFormatted.trim())) {
selectPlotList += ",\n "
+ formatField(strField, job.isModeJob() || job.isMtdJob(), true);
}

}
}
Expand Down Expand Up @@ -2515,11 +2520,14 @@ public List<String> buildPlotModeEventEqualizeSql(
if (listPlotFixVal.length > 0) {
for (int i = 0; i < listPlotFixVal.length; i++) {
String strField = (String) listPlotFixVal[i].getKey();
String fieldFormatted = formatField(strField, job.isModeJob() || job.isMtdJob(), true);
if (listPlotFixVal[i].getValue() != null) {
selectList += ",\n "
+ formatField(strField, job.isModeJob() || job.isMtdJob(), true);
selectPlotList += ",\n "
+ formatField(strField, job.isModeJob() || job.isMtdJob(), true);
if(!selectList.contains(fieldFormatted.trim())) {
selectList += ",\n " + fieldFormatted;
}
if(!selectPlotList.contains(fieldFormatted.trim())) {
selectPlotList += ",\n " + fieldFormatted;
}
}
}
}
Expand Down Expand Up @@ -2849,8 +2857,11 @@ public int buildAndExecuteQueriesForRocRelyJob(
if (listPlotFixVal.length > 0) {
for (int i = 0; i < listPlotFixVal.length; i++) {
String strField = (String) listPlotFixVal[i].getKey();
String fieldFormatted = formatField(strField, job.isModeJob() || job.isMtdJob(), true);
if (!strField.equals("fcst_var") && listPlotFixVal[i].getValue() != null) {
strPlotDataSelect += formatField(strField, job.isModeJob() || job.isMtdJob(), true) + ",\n";
if(!strPlotDataSelect.contains(fieldFormatted.trim())) {
strPlotDataSelect += fieldFormatted + ",\n";
}

}
}
Expand Down Expand Up @@ -3105,7 +3116,9 @@ public int buildAndExecuteQueriesForEclvJob(
if (listPlotFixVal.length > 0) {
for (Map.Entry aListPlotFixVal : listPlotFixVal) {
String strField = (String) aListPlotFixVal.getKey();
strPlotDataSelect = strPlotDataSelect + strField + ",\n";
if(!strPlotDataSelect.contains(strField)) {
strPlotDataSelect = strPlotDataSelect + strField + ",\n";
}
}
}

Expand Down

0 comments on commit 5f20cf4

Please sign in to comment.