I'm trying to design a feature where the user can specify what data they get back from a query. Below are the search options to the end user.
- Players with a contract (non-null contractId)
- Players without a contract (null contractId)
- All Players (null or non-null contractId)
I'd like to make a function that can take a String and plug it into a query to return the desired data set.
public ArrayList<Player> getPlayers(String contractFilter) {
String query = "... WHERE player.ContractId is " + contractFilter;
}
With this design, I can pass in contractFilter = "null"
or contractFilter = "not null"
. Is there something I can pass in for the 3rd condition (null OR non-null)? Something like contractFilter = "any"
?
Aucun commentaire:
Enregistrer un commentaire