Guest User

QueryHandler.java

a guest
Jan 16th, 2014
511
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. import com.sforce.soap.partner.Field;
  3.  
  4.  
  5.  
  6.  
  7. public class QueryHandler
  8. {
  9.  
  10. public QueryHandler(){
  11. }
  12. //generates query of all fields on an object, called in login() function back in BulkExample
  13. //may or may not be needed.
  14. public String generateQuery(Field[] fields, String object){
  15. StringBuilder sb = new StringBuilder();
  16. sb.append("SELECT ");
  17. for(Field f:fields){
  18. sb.append(" "+f.getName());
  19. sb.append(",");
  20. }
  21. sb.deleteCharAt(sb.length()-1);
  22. sb.append(" FROM "+ object);
  23. return sb.toString();
  24. }
  25. }
RAW Paste Data