Exercises for the Web Database
The initial exercise:
- Copy dbform.html,
db.c and
people.txt to your directory.
- DO NOT COPY dir.alp -- it is too big. Create
your own text file.
- Rename db.c to be db-$sno$.c.
- Change the FNM and RFNM strings in db-$sno$.c
to refer to the files in your directory.
- Compile db-$sno$.c, and copy it to the student
CGI directory.
- Modify your dbform.html to refer to db-$sno$.
- Make sure that your people.txt file is writeable
by everyone (e.g. chmod w+a people.txt). This allows
db-$sno$ to modify it.
- Try executing db-$sno$ via dbform.html.
Some further exercises:
- Make sure you understand the working of process_pats(),
num_matches(), and record_details(). They use UNIX features
which are useful in a wide range of applications.
- How could the database search be speeded up? Would multiple
databases help?
Hint. Since this program is complex, you may find it
easier to test by using input_entries() rather than build_entries().
input_entries() allows you to enter form details (name=value pairs)
from stdin so that the Web does not need to be involved.
Assignment
Extend the database application.
For example, it could be improved in ONE of the following ways:
- buttons/radioboxes for something
- the input of text containing regular expressions, such
as And* to match Andy, Andrew, and
other strings starting with And
DOCUMENT the code and your changes at the
start of db-$sno$.c.
E-mail me your copy of db-$sno$.c
by 5pm, Friday 10th July.
Also, e-mail me details on how to run your copy (e.g. the address
of your database search page).
My e-mail address is ad@ratree.psu.ac.th.
I will be checking the code in your directories. Do not
delete anything until the end of the semester.
Back to the Main Web Database Page