Mercurial > dive4elements > river
changeset 4517:a5e4fae31089
Fixed SQL statements and parameters.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Wed, 14 Nov 2012 17:06:51 +0100 |
parents | de4832ffde2a |
children | 2eabb5aa0bb6 |
files | flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/SedimentLoadFactory.java |
diffstat | 1 files changed, 10 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/SedimentLoadFactory.java Wed Nov 14 17:04:01 2012 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/SedimentLoadFactory.java Wed Nov 14 17:06:51 2012 +0100 @@ -74,7 +74,8 @@ public static final String SQL_SELECT_EPOCHS_DATA = "SELECT" + " sy.description AS description, " + - " ti.start_time AS year, " + + " ti.start_time AS startYear, " + + " ti.stop_time AS endYear, " + " syv.value AS load, " + " syv.station AS km " + " FROM sediment_yield sy" + @@ -195,7 +196,6 @@ Session session = SessionHolder.HOLDER.get(); SQLQuery sqlQuery = null; - if (type.equals("single")) { sqlQuery = session.createSQLQuery(SQL_SELECT_SINGLES) .addScalar("description", StandardBasicTypes.STRING) @@ -254,7 +254,6 @@ int eyear ) { log.debug("SedimentLoadFactory.getSedimentLoadWithDataUncached"); - Session session = SessionHolder.HOLDER.get(); SQLQuery sqlQuery = null; @@ -289,6 +288,7 @@ getValues("suspended_sediment", sqlQuery, load); getValues("susp_sand_bed", sqlQuery, load); getValues("susp_sand", sqlQuery, load); + return load; } else if (type.equals("off_epoch")) { @@ -297,16 +297,17 @@ Calendar toEnd = Calendar.getInstance(); toEnd.set(eyear, 12, 31); - sqlQuery = session.createSQLQuery(SQL_SELECT_EPOCHS) + sqlQuery = session.createSQLQuery(SQL_SELECT_EPOCHS_DATA) .addScalar("description", StandardBasicTypes.STRING) - .addScalar("start_time", StandardBasicTypes.DATE) - .addScalar("stop_time", StandardBasicTypes.DATE) - .addScalar("load", StandardBasicTypes.DOUBLE); + .addScalar("startYear", StandardBasicTypes.DATE) + .addScalar("stopYear", StandardBasicTypes.DATE) + .addScalar("load", StandardBasicTypes.DOUBLE) + .addScalar("km", StandardBasicTypes.DOUBLE); sqlQuery.setString("name", river); sqlQuery.setDouble("startKm", startKm); sqlQuery.setDouble("endKm", endKm); sqlQuery.setDate("sbegin", start.getTime()); - sqlQuery.setDate("sbegin", end.getTime()); + sqlQuery.setDate("send", end.getTime()); sqlQuery.setDate("ebegin",toStart.getTime()); sqlQuery.setDate("eend", toEnd.getTime()); sqlQuery.setString("grain", "total"); @@ -365,7 +366,7 @@ else if (fraction.equals("suspended_sediment")) { load.setSuspSediment(km, v); } - else if (fraction.equals("sups_sand")) { + else if (fraction.equals("susp_sand")) { load.setSuspSand(km, v); } else if (fraction.equals("susp_sand_bed")) {