title: android content provider query builder
body: <p>I have  variables, each of them with the possibility of being empty. I use these  to create my arguments:</p>
  
  <pre><code>String[] arguments = {argClassOfExercise, argPeriodOfPeriodisation, argAgeGroup, argPrDistanceGroup, argVo2Max};
  </code></pre>
  
  <p>and to define my WHERE CLAUSE I use </p>
  
  <pre><code>String selection = "catalog.ex_class = ? AND catalog.period = ? AND catalog.age_group = ? AND catalog.pr_comp_grouping = ? AND catalog.vo2max = ?";
  </code></pre>
  
  <p>putting it all in my cursorloader:</p>
  
  <pre><code>CursorLoader cursorLoader = new CursorLoader(getActivity(), CatalogProvider.CONTENT_URI_TRANSLATION, projection, selection, arguments, null);
  </code></pre>
  
  <p>Now this will all work fine until one of the variables is empty. Since none of the database values will be equal to and empty string. Is there a possibility to exclude a WHERE  CLAUSE if that particular variable is empty? </p>
  
  <p>I know you can write a bunch of IF statements but that would result in me writing 11 of them and I don't think that's really efficient.</p>
  
  <p>Any ideas are welcome</p>