CS145 Assignment #7

Due Tuesday, June 3, 1997

Step 7 of Your PDA

  • (50 pts.) Your PDA assignment for this week is to build a user-friendly interactive application program front end to your PDA using the C or C++ programming language and embedded SQL. There is a Guide to the Oracle Pro*C Embedded SQL System available to give you the basics of this facility.

    Your program should consist of a continuous loop in which:

    1.
    A list of at least five alternative options is offered to the user. (an additional alternative should be quit.)
    2.
    The user selects an alternative.
    3.
    The system prompts the user for appropriate input values.
    4.
    The system accesses the database to perform the appropriate queries and/or modifications.
    5.
    Data or an appropriate acknowledgment is returned to the user.

    You should include both queries and modifications. For example, if your PDA were about bars, beers, and drinkers you might offer options such as
    1. Look up the price of a given beer at a given bar.
    2. Find the bar with the lowest price for a given beer.
    3. Given a drinker, find all the other drinkers that frequent at least one bar in common.
    4. Add a new beer to the Beers relation.
    5. Increase all the prices at a given bar by a given amount.
    6. Quit.

    We are not expecting anything fancy in the way of interace. For example, a menu printed via printf is OK. Also, handling of SQL errors can be quite simple. Either write an sqlerror routine that just prints the error message from Oracle or copy the error handler from a sample program (of course you should acknowledge this borrowing just as you would acknowledge any other use of someone else's work in your homework or project).

    Hand in your program and a script showing the program running. Each of the options should be exercised at least once in your script.

    Problem Set

    1. (6 pts.) Exercise 4.3.1(e) [p. 208].

    2. (6 pts.) Exercise 4.3.4(c) [p. 209].

    3. (10 pts.) Exercise 4.4.2(b) [p. 222].

    4. (6 pts.) Exercise 5.10.1(c) [p. 323]. Note this question is the same problem as (3), in the SQL3 notation.

    5. (6 pts.) Exercise 8.2.1(b) [p. 426].

    6. (6 pts.) Exercise 8.2.1(e) [p. 426].

    7. (10 pts.) Exercise 8.3.2(c) [p. 433].