1. Homepage
  2. Exam
  3. [2022] COMP9315 DBMS Implementation 22T1 - Final Exam - Q3 Insert Tuple

[2022] COMP9315 DBMS Implementation 22T1 - Final Exam - Q3 Insert Tuple

This question has been solved
Engage in a Conversation

Question 3 (25 marks)

The q3 directory contains an incomplete program q3.c. You must complete this program so that it reads tuples from a file and inserts them into newly-created "no-frills" data file (see [Q1-3 Info] for details on what a "no-frills" data file is). The program takes two command-line arguments: the first is the name of the "no-frills" data file to be created, the second is the name of the file containing the tuples, e.g. CourseNana.COM

$ ./q3 myData < data/insert200

Insert each tuple into a page buffer, which is initially all zeroes. Tuples are inserted directly one after another, where the next tuple occurs immediately after the '\0' that terminates the previous tuple. When there is insufficient space to add the next tuple, write out the page buffer, clear it, and start inserting tuples into it. Note that the last tuple in a page should be followed by a '\0' character, which follows immediately after the tuple's own terminating '\0' character. CourseNana.COM

If the tuples file is empty, you must write a data page containing no tuples; you cannot leave the file totally empty (i.e. it must have at least PAGESIZE bytes). CourseNana.COM

The command-line argument processing is already handled in q3.c. By the time it reaches the code you need to write, you will have a valid file descriptor for the "no-frills" data file and a valid file pointer for the tuple file. There are examples of using ./q3 in the testsdirectory. You should also be able to devise your own test cases easily enough. CourseNana.COM

Note that you need to maintain the tuple count in each page as you add tuples. The data file you build should be able to be examined by the q1 command and return the correct number of tuples. CourseNana.COM

To help you check whether your program is working correctly, there is a script called run_tests.sh which will run the program against the test cases in the tests directory and report the results. It will also put the data file created by your program in the current directory (i.e. your q3 directory). The example data/inputX files create the data/DataY files in the data directory. The testing script then compares the created data file against the relevant data file and reports whether it matches this file. If the created data file is not identical to the actual data file, then the script reports a failure. CourseNana.COM

You can examine the test cases by looking at the tests/*.sh files. You can run the testing script as: CourseNana.COM

$ sh run_tests.sh

Once your function is working (passes all tests), follow the submission instructions below. Even if it fails some (or even all) tests, you should submit because you can get some marks. If your program does not compile, or if you simply submit the supplied code, then your "answer" is worth zero marks. CourseNana.COM

Submission Instructions: CourseNana.COM

  • Type your answer to this question into the file called q3.c
  • Submit via:   give cs9315 exam_q3 q3.c 
    or via: Webcms3 > exams > Final Exam > Q3 submission > Make Submission
End of Question

Get the Solution to This Question

WeChat WeChat
Whatsapp WhatsApp
COMP9315代写,Database Implementation代写, The University of New South Wales.代写,COMP9315代编,Database Implementation代编, The University of New South Wales.代编,COMP9315代考,Database Implementation代考, The University of New South Wales.代考,COMP9315help,Database Implementationhelp, The University of New South Wales.help,COMP9315作业代写,Database Implementation作业代写, The University of New South Wales.作业代写,COMP9315编程代写,Database Implementation编程代写, The University of New South Wales.编程代写,COMP9315programming help,Database Implementationprogramming help, The University of New South Wales.programming help,COMP9315assignment help,Database Implementationassignment help, The University of New South Wales.assignment help,COMP9315solution,Database Implementationsolution, The University of New South Wales.solution,