aspose file tools
The moose likes JDBC and the fly likes Building Dynamic Query Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "Building Dynamic Query" Watch "Building Dynamic Query" New topic
Author

Building Dynamic Query

Gregg Bolinger
Ranch Hand

Joined: Jul 11, 2001
Posts: 15230

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

Joined: Nov 09, 2000
Posts: 31
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.


martin samm<BR>m_sam@rroom.net
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Building Dynamic Query
 
Similar Threads
design a web based fund search screen
charts/graphs
Dynamic messages
Doubt on Java based reporting tool embedded into web based application
Time Taken by any sql query