Hi,

there is a CGI form that enables users obtain information from library.
We have a set of books (1st table), their authors (2nd table), readers' 
opinions about the book (3rd table), errata of the book (4rd table).

Typical queries:
- show records with a title 'xxx',
- show records whose author is 'yyy',
- show records whose opinions include a word 'zzz',
- show records whose errata include a word 'qqqq' and author 
  starts with 'b'.

A single record should include all the information attached with a book.
The results may contain many records.

The problems are:
1. Is it possible to prepare generic, unchangable SQL query, that will be
able to meet user's request just by binding its parameters with values he typed? 
What are the best methods of creating dynamic SQL statements based on user
input? Anyone tried HTML::Template? Any other tools?

2. What is the best way to get the data from tables? Should it be done with
one query that fetches all rows, with many duplicated data? Or maybe one should
try to do many simpler queries that fetches only distinct data?

I would like to hear what your experience is as far as that problem is
concerned.

Best regards,
Wojciech Pietron

Reply via email to