Hi all,
This is an interview question, how to make the code perform better? Asume all codes work fine. Thanks.
String paymentType = im.getType();
String debitBankCode = im.getField("DEBIT_BANK_CODE");
String beneBankCountry = im.getField("BENE_BANK_COUNTRY");
String paymentMethod = im.getField("PAYMENTMETHOD");
SystemLogicImpl sysLogic = new SystemLogicImpl();
sysLogic.setEnvironment(environment);
DBRecord record = null;
StringBuffer sb = BufferPoolUtil.getBuffer(128);
sb.setLength(0);
try
{
if (sysLogic != null)
{
sb.append("select fieldname from rtgsstprule where paymenttype='");
sb.append(paymentType);
sb.append("' and debitbankcode = '");
sb.append(debitBankCode);
sb.append("' and benebankcountry = '");
sb.append(beneBankCountry);
sb.append("' and paymentmethod='");
sb.append(paymentMethod);
sb.append("'");
ArrayList resultSet = sysLogic.getDBRecords(sb.toString(),"WEB");
Iterator itr = resultSet.listIterator();
while (itr.hasNext())
{
record = (DBRecord)itr.next();
String fieldName = record.getField("fieldname");
if(fieldName.equals(fldName)){
return true;
}
}
}
}
[ April 13, 2008: Message edited by: Bear Bibeault ]