Clarisse U.

asked • 01/15/21

Database management System

Write a menu driven program to create and operate on a relational database that, prospectively, can be used by a library using Java or C++

One relation is stored in one data file. Because these files can have different structure, each file includes a heading that stores information about this structure. This information may include 1. the number of columns in the table, 2. the length of one record, 3. a list of all column names with their lengths.

Write functions/methods createTable(), insert(), remove(), printFile(), and purge() that operate on these files.

The createTable() function creates a file whose name is entered by the user. Here is an example (the underlined entries are typed by the user):

enter table name: books

enter column name and its length: author 20

enter column name and its length: title 20

enter column name and its length: callNo 5

enter column name and its length:

After this, the file books.dbf is created with number 45 for the length of one record and with column names author, title, and callNo in its heading. Also, the newly created file is added to the system catalog dbFiles which is a file created and maintained by your program (if you run your program next time, do not recreate this file!).

insert() allows you to add new entries (records) to a file. For example, you may have the following sequence of entries after choosing the insert option:

enter file name: books

author: Burnett Frances

title: The Secret Garden

callNo: MN432

More entries (Y/n):

author: Wesley John

title: Journal

callNo: PQ945

More entries (Y/n): n

remove() allows you to remove any record from any file. The prompts may be similar to those for inserting records. When deleting a record, put only a tombstone in the data file and continue running your program. A tombstone can be some special character – e.g., the sharp sign # – which is written over the first character in the record.

After exit is chosen from the menu, call the function purge() for all the data files to be found in dbFiles. Purging consists in permanently removing all the removed records from each file.

 


Patrick B.

Also, a bit unclear from the beginning... "create and operate on a relational database that, prospectively, can be used by a library using Java or C++"; Relational database consists of 2 or more tables, which I attempted to do.. but then you got primary keys, foreign keys, composite keys, etc. ,,,, Can prospectively be used by a library... do we need to compile it to a *.lib or *.dll? Is this a windows app or a console app?
Report

01/16/21

1 Expert Answer

By:

Patrick B. answered • 01/16/21

Tutor
4.7 (31)

Math and computer tutor/teacher

Clarisse U.

First of all thank you so much for the work you have done so far. I was not able to see the source code but i read through your command. This project is a beginning for a database class, and we should except some errors and we should not use complicated concepts. With that being said, I think we can use JAVA to make it more easy and faster. Question #1.We have to keep the size and the format of the input regardless that some inputs won't be able to fit in. Question #2. We are not allowed to delete the data just have to mark them for deletion and purge on exit. I hope this is helpful and please don't hesitate to reach out in case you need more clarity. Lastly if you can help me see the source code that would be appreciated.
Report

01/16/21

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.