Well,
here's my solution for it.
I'm working on an SQL construction library. It has a few classes to
construct and alter SQL statements. It's meant as an API/library, so
something that you control from your code, not like a visual query builder
or so.
It's not finished yet, but it works very well for me. I don't know why but
up till now, I haven't seen many people interested. Although I think it's
really powerful.

For your question I would create something like this

SqlStatement sql = new SqlStatement();
sql.addColumn("id");
sql.addColumn("title);
sql.addTable("book");
String bookType = // get the booktype selection
sql.and(new ColumnCondition("type",bookType));
// note that if bookType==null the condition ill not show up on the
resulting SQL!

// or you could use a Vector to define criteria
Vector category = new Vector();
criteria.add("sience-fiction");
criteria.add("computer");
sql.and(new ColumnCondition("category",category));

// If the vector is empty, it will not use this condition, if it's just a
single element

Get the idea?
Let me know if you think this library might help you. I'm thinking about
putting it online anyway.

Geert Van Damme

> -----Original Message-----
> From: A mailing list about Java Server Pages specification and reference
> [mailto:[EMAIL PROTECTED]]On Behalf Of Mayuresh Kadu
> Sent: dinsdag 22 mei 2001 9:37
> To: [EMAIL PROTECTED]
> Subject: Filters
>
>
> hello all,
>
> i am trying to work out the functionality of filters (something
> similiar to
> the one we see when we see a MSWindows Common DialogBox like FileOpen )
>
> I have a RecordSet containing a set of records. Say A List of books. Now
> what i want is being able to define a set of static filters (static at the
> moment - later - User Defined) say like
>
>
> Show Books where [ Book-Type ] is [ Paperback ]
>
> where item marked in [] are dynamic. I am using Tomcat 3.2.1 with
> IE5/NN4+.
> When a user selects  "Publisher" from criteria list he should
> automatically
> get a list of DISTINCT (of SQL -- Select DISTINCT -- fame)
> publishers and so
> on.. I also want to have as optimized database calls as possible.
>
> Any inputs are appreciated !
>
> Cheerio !
>
> Mayuresh Kadu
> --------------
> Aftek Infosys Ltd., Pune
> http://www.aftek.com
>
> ==================================================================
> =========
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set
> JSP-INTEREST DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
  • Filters Mayuresh Kadu
    • Geert Van Damme

Reply via email to