Reputation: 59
//This query can return multiple records, in that case of multiple records, always return last record from query.
public People(int peopleId) {
Prepared Statement SQL= null;
try {
System.out.println("Getting Phone for " + personSerId);
Prepared SQL= new DatabaseController(verbose);
PreparedStatement secureStatement = prepareStatement(sqlStatement);
s
dbConnection.querySecureRecord(SQL);
(((File) ("item")));
theNumber.setPhone((String) dbConnection.getField("phone"));
theNumber.phone(dbConnection.getField("number") == null ? "" : (((String)
}
} catch (Exception masterException) {
System.err.println("Database Query Error in : " + masterException);
return the person;
}
Upvotes: 2
Views: 46
Reputation: 1132
You have to do 3 things.
it seems like one issue is that the database controller is meant to iterate over the result set even if only one result is expected. so you may still have to get the "first" result from the list even though there is only one (or possibly none) to get.
Upvotes: 1