/******************************************************/
/*Library Database*/
/*Book Update Application*/
/*File bookupd.osq/Mike Leigh/19-10-1993*/
/*******************************************************/
INITIALIZE (
rowstat = integer1,
booktbl.isbnx_old=CHAR(8)
)
=BEGIN
rowstat=0;
RESUME FIELD pub_code;
END
FIELD 'pub_code'
= BEGIN
bookupd = SELECT pub_name FROM publisher
WHERE pub_code = :pub_code
booktbl = SELECT isbnx, isbnx_old = isbnx, title,
pub_date, now_price
FROM book
WHERE pub_code = :pub_code;
RESUME FIELD booktbl.isbnx;
END
KEY FRSKEY1
=BEGIN
HELPFILE 'Book Update Frame'
'/u/homedirectory/bookupd.hlp';
END
'Go'=BEGIN
UNLOADTABLE booktbl (rowstat=_STATE)
{
IF rowstat=1 THEN/*add row to database*/
INSERT INTO book (isbnx, pub_code, title, pub_date, now_price)
VALUES (:booktbl.isbnx,
:pub_code,
:booktbl.title,
:booktbl.pub_date,
:booktbl.now_price);
ELSEIF rowstat = 3 THEN/*update row in database*/
UPDATE book
SET isbnx=:booktbl.isbnx,
pub_code=:pub_code,
title=:booktbl.title,
pub_date=:booktbl.pub_date,
now_price=:booktbl now_price
WHERE isbnx =:booktbl.isbnx_old;
ELSEIF rowstat = 4 THEN /*delete row from database */
DELETE FROM book
WHERE isbnx = booktbl.isbnx_old;
ENDIF;
};
END
'DeleteRow' =BEGIN
DELETEROW booktbl;
END
'Next'= BEGIN
CLEAR FIELD ALL;
RESUME FIELD pub_code;
END
'Quit'=BEGIN
EXIT;
END
/* end of 4GL code */
APPENDIX F(cont.)
LIBRARY DATABASE Books Published Maintenance:
Publisher Code: FUTR
Name:Futura Publications
ISBNTitleDatePrice
70884259708844407088805970888267The Wooden SpaceshipsThe Ascension FactorFuture HistoryThe Smoke Ring19891990197719883.993.993.994.99
Press 'F1' for help on this Frame
Select 'GO' to Update the Database
=============================================================
Go DeleteRow Next Quit
APPENDIX F (cont.)
(File: bookupd.hlp)
LIBRARY DATABASE Book Details Maintenance Frame:
Frame Description:
This frame is used to maintain book information on the book table.
When a Publisher Code is entered into the appropriate field. The system retrieves the Publisher's name and the details of the books that are published by that publisher. You are then able to edit the data displayed in the table field.
To use this Frame:
1)Enter the Publisher Code
The system displays Publisher name as a verification and retrieves book details. 2)You can edit the book details by:-
a) APPENDING new book records.
b) UPDATING existing values in the records.
c) DELETING an existing record (using the DeleteRow menu option), or
d) Leaving existing records unchanged.
3)Once you have finished editing the book data select "Go" from the menu line to
update the Database.
4)The menu option "Next" will clear the screen to allow the next publisher's code
to be entered.
5)The "Quit" option returns you to the previous menu.
This WWW material is copyright De Montfort University and may only be reproduced or used if this copyright notice is included.