Forum de discussion
Forum « Programmation JAVA » (archives)
optimisation requette mysql
Envoyé: 6 février 2003, 8h55 par jm
merci de votre participation
à+ jm
private boolean majInfoHistoriqueExiste() {
int total = 0;
DBConnection dbConn = null;
String sql = null;
try
{
dbConn = TurbineDB.getConnection(nomBaseClient);
if (dbConn == null) {
log.error("Can't get database connection");
return false;
}
Statement stmt = dbConn.createStatement();
sql = "SELECT count(*) FROM T_Mission ";
sql += "where MissionDriverCode="+String.valueOf(codeConducteur)+" ;";
ResultSet rs = stmt.executeQuery(sql);
if (rs.next()) {
total = rs.getInt(1);
}
rs.close();
stmt.close();
}
catch (Exception e) {
log.error("Error during sql", e);
}
finally {
try {
TurbineDB.releaseConnection(dbConn);
}
catch (Exception e) {
log.error("Error during releaseConnection", e);
}
}
infoHistoriqueExiste = (total>0?true:false);
return infoHistoriqueExiste;
}
Réponses
|