1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
long startTime = System.currentTimeMillis();
CallableStatement cs = null;
ResultSet rs = null;
// initialisation du nombre de parts pour le Responsable, sur le fonds considere, a la date donnee
double dStockNbParts = 0.0d;
try{
Connection cn = getConnection();
cs = cn.prepareCall("{call CalculerStockNbParts(?, ?, ?)}");
cs.setInt(1, idEntiteResponsable);
cs.setInt(2, idFonds);
cs.setDate(3, new java.sql.Date(dateFinHistorique.getTime()));
rs = cs.executeQuery();
if(rs.next()){
dStockNbParts = rs.getDouble("nbPartsStockTotal");
}
rs.close();
cs.close();
cs = cn.prepareCall("{call CalculerStockNbParts(?, ?, ?)}");
cs.setInt(1, idEntiteResponsable);
cs.setInt(2, idFonds);
cs.setDate(3, new java.sql.Date(dateFinHistorique.getTime()));
rs = cs.executeQuery();
if(rs.next()){
dStockNbParts = rs.getDouble("nbPartsStockTotal");
}
rs.close();
cs.close();
}catch(SQLException sqle){
sqle.printStackTrace();
throw new SQLException("Impossible d'exécuter la requête: " + sqle.toString());
}finally{
releaseResultSet(rs);
rs = null;
releaseStatement(cs);
cs = null;
}
long endTime = System.currentTimeMillis();
System.err.println("(PS) Temps pour calculer les parts (idER, idFonds, date) = ("
+idEntiteResponsable+", "+idFonds+", "+GUI.date2Stringdd_MM_yyyy(dateFinHistorique)+") : "+(endTime-startTime)+" ms"
+" - call CalculerStockNbParts("+idEntiteResponsable+", "+idFonds+", '"+UtilsDate.convertDateToString(dateFinHistorique, "yyyy-MM-dd")+"')"
); |
Partager