$29
Overview
In this assignment you will write a program that allows a database user to insert, delete, modify, and query their data on basic tables (i.e., no table joins). It is assumed that the database and table structures (i.e., their metadata) are ready, which should have been completed in the frst assignment.
System Design
You will decide how to physically store the data o In lectures: row-based, column based, etc.
o As always, you are free (in fact, encouraged) to come up with your own design
If in your frst assignment you decided to use the mapping of directory-database and fle-table, then the following is one possible physical layout of the fle for table Product (pid, name, price):
pid int | name varchar(20) | price foat 1 | laptop | 1999.99
2 | mobile phone | 899.99
3 | monitor | 1399.99
Once you decide the physical layout, you will then need to think about how those four operations (insert, delete, modify, and query) will work.
o Again, if you follow the above fle-table design: Insert: append to the last line?
Modify and query: should be easy
Delete: move the tuples around?
Implementation
The program should not use external database library/application…
Any programming language is acceptable, e.g., Python, Java, C/C++, Go o Just pick one(s) that you are most comfortable/profcient with
o But keep in mind we will test your code in Linux with OS-level utilities (e.g., fles)
So, probably not: C#, Object-C, JavaScript, Prolog… Functionalities:
CS457/657 Spring 2018 – Programming Assignment 2
SQL: insert tuples, delete tuples, modify tuples, basic select on tuples
Interface
A similar but simpler interface than Sqlite3
Same as homework #1: standard input, standard output.
Testing
We will test your program on Ubuntu (version 14 or above)
If your program cannot compile on our testbed, we may ask you to demo your program
o Try not to use many exotic libraries… A full test script will be provided
# ~/cs457/pa2/<your_program < PA1_test.sql (expect the standard input)
# <expected output
You don’t need to parse the comment lines (i.e., starting with “- -“)
We will not to test your programs with any other scripts/commands It’s always good to consider more corners cases
Grading (100 points)
This assignment can be completed by a group of 1-3 students o All group members will receive the same score
Design document that clarifes the followings: (10 points)
How your program store tuples in the table
At a very high level, how you implement those required functionalities, i.e., tuple insertion, deletion, modifcation, and query.
Be very specifc on how to compile and execute your code Source code (90 points)
Coding style, 10 points
Appropriate parenthesis locations, indention, etc.
Coding clarity, 10 points
Always write comments at the beginning of any fles Author, date, history, etc.
Always write comments at the beginning of any non-trivial class/ function
What this class/function does, high-level algorithm if needed
Write in-line comments for non-trivial blocks of code
Functionality, 70 points
Refer to the test script for detailed breakdowns
Submission
2 CS457/657 Spring 2018 – Programming Assignment 2
WebCampus
Compress all your source code and documents into one package in this format:
o <your_netid_pa2
Each group member should submit his/her own copy of the package Late penalty: 10% per day (if you don’t use the 4-day grace period)
CS457/657 Spring 2018 – Programming Assignment 2