Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Building Dynamic Query

 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am creating a search engine for my database. I have JCheckBoxes that enable/diable JTextFields and/or JComboBoxes. I need to build a query based on what the user has selected and what has been typed in the textFields. Right now, there are a huge amount of IF statements in my code. But I was wondering if anyone knows a better, more dynamic way to build a query based on what I have told you.
Thanks for any help.
 
martin samm
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how about trying regexp (IBM's regexp4j or Apaches jakarta-oro)? Create a full query string with placeholders and perform search/replace with the data you receive.
I have to admit i haven't tried this, but it sounds feasible.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic