Provides the proper SQL SELECT statement based on the values
that come from a database row stored in the Hashtable. If the
Hashtable is null, then all accounts are retrieved.
If a customer ID is passed, then all accounts for that customer
ID are provided.
if( h == null ) { // If no query criteria are specified
return "SELECT * from t_accounts";
}
else {
String tmp = "SELECT * from t_accounts WHERE ";
int cust_id = -1;
// SELECT * from t_accounts
// WHERE cust_id = 1
if( h.containsKey("cust_id") ) {
cust_id = ((Integer)h.get("cust_id")).intValue();
}
return tmp + "cust_id = " + cust_id;
}