DebugFile.writeln("Begin updateConversionRates([Connection], "+sBaseCurrency+")");
DebugFile.incIdent();
lTsStart = new Date().getTime();
}
Timestamp oTsNow = new Timestamp(new Date().getTime());
CurrencyCode oCurrBase = CurrencyCode.currencyCodeFor(sBaseCurrency.toUpperCase());
ArrayList aList = new ArrayList(300);
Statement oList = oConn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
ResultSet rList = oList.executeQuery("SELECT DISTINCT("+DB.alpha_code+") FROM "+DB.k_lu_currencies);
while (rList.next()) {
aList.add(rList.getString(1));
} // wend
rList.close();
oList.close();
PreparedStatement oInsr = oConn.prepareStatement("INSERT INTO "+DB.k_lu_currencies_history+" ("+DB.alpha_code_from+","+DB.alpha_code_to+","+DB.nu_conversion+","+DB.dt_stamp+") VALUES ('"+sBaseCurrency.toUpperCase()+"',?,?,?)");
PreparedStatement oUpdt = oConn.prepareStatement("UPDATE "+DB.k_lu_currencies+" SET "+DB.nu_conversion+"=? WHERE "+DB.alpha_code+"=?");
Iterator oIter = aList.iterator();
while (oIter.hasNext()) {
String sAlphaCode = (String) oIter.next();
try {
double dRate = oCurrBase.conversionRateTo(sAlphaCode);
oUpdt.setBigDecimal(1, new BigDecimal(dRate));
oUpdt.setString(2, sAlphaCode);
if (0d!=dRate) {
oInsr.setString(1, sAlphaCode);
oInsr.setBigDecimal(2, new BigDecimal(dRate));