Download CSCI 2230-Programming Assignment 2: Database Catalogs - Prof. Vernon W. Pine and more Assignments Digital Signal Processing in PDF only on Docsity! CSCI 2230-001 Programming Assignment #2 Due: 4 March Database Catalogs Goals You will become familiar with the use of catalogs to store meta-data about database tables. The program will use low-level access methods to read and write records of fixed length. You must implement your solution on einstein. This program must be done in groups of two or three students. 1. Startup On program startup, the shell command line should contain the name of a database. If this is a new database, create a new subdirectory using that name, make that subdirectory the current working directory, and create the two database catalogs. If this is an existing database, change to that subdirectory and open the two catalogs. If no database name is given, display an error message and quit. The catalogs are two binary (fixed length record) files, the relation catalog and the attribute catalog, using the following fixed record formats exactly: relcat( char relname[20], int reclength, int attrcount, int reccount, int sortfield, char format) attrcat( int attrnum, int attroffset, int attrlength, char attrtype, char attname[20], char relname[20]) Declare classes for each of these types. You may find it useful to create a “set all fields” member function for each, since you’ll be writing several hard-coded records to each file. When a database is created, both catalog files should be created, the first called “relcat” and the second called “attrcat” (no file extensions). The relcat will initially have two entries (one for the relcat itself and one for the attrcat), and the attrcat will have twelve entries (six for the re1cat attributes and six for the attrcat attributes). Refer to the class handout for the data contained in these entries. 2. Data Format Only three types of data will be our database: integer denoted by an I in the attrcat’s attrtype field, double denoted by a D, and character denoted by a C and a length. A data file may either be fixed length or variable length. For fixed length records, create a binary file, and place the letter F in the relcat’s format field. For variable length records, create a text file, and delimit the records with the character | , and place the letter V in the relcat’s format field. For now, only the catalogs exist; since both are fixed length files, both will contain an F in the format field. Later assignments will clarify the data format. 3. Commands Read commands from the standard input. Do not prompt for them, however. Your program will be run against a test script, which may not work with prompting. Include simple error checking - display an error message on incorrect commands. See below for examples. a. Show Catalogs. Command: S Display the contents of the relcat and attrcat, in neat tabular format, with column headings and reasonable spacing.