while(rs.next()){ String owner; int count;
if (!rs.next()) { if (l.isMinorEnabled()) { l.logMessage(Logger.MINOR,Logger.DB_WRITE,"no rows returned from sql " + sql); } insertRow(l,s,run,"All Units",0); } else { if (l.isMinorEnabled()) { l.logMessage(Logger.MINOR,Logger.DB_WRITE,"some rows returned from sql " + sql); } do { String owner; int count;
  protected void insertResults (Logger l, Statement s, int run) {    ResultSet rs=null;    String sql = null;        try {      sql = getQuery(run);      rs=s.executeQuery(sql);    } catch (SQLException sqle) {      l.logMessage(Logger.ERROR,Logger.DB_WRITE,		   "UnitCargoAmountTest.insertResults - Problem executing query : " + sql,		   sqle);    }    try {      while(rs.next()){		String owner;		int count;		  		if (groupByUnit) {		  owner = rs.getString(1);		  count = rs.getInt(2);		}		else {		  owner = "All Units";		  count = rs.getInt(1);		}			insertRow(l,s,run,owner,count);      }        } catch (SQLException sqle) {      l.logMessage(Logger.ERROR,Logger.DB_WRITE,		   "UnitMilvansTest.insertResults - Problem walking results.",sqle);    }  }