-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDOCUMENTATION.txt
More file actions
38 lines (32 loc) · 2.16 KB
/
DOCUMENTATION.txt
File metadata and controls
38 lines (32 loc) · 2.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
Project 4 By: Willis Allstead
=============================
How To Compile/Run
------------------
To get it built just make sure you have swift v4+ installed and cd into the pa4 directory.
Also make sure the PA4_test.sql is in the pa4 directory.
Once you're in the directory run this command in terminal: "swift run pa4"
It should build and run and it will accept either std input with the < operator or take commands line by line.
If you have any issues let me know, thanks!
How Tuples are Handled
---------------------
Tuples are stored in a table under the table metadata in the table files.
Tuple insertion is done by editing that file, inserting at whatever tuple index is required.
Tuple deletion is done similarly, but then collapsing the file to remove empty whitespaces.
Tuple modification is done similarly as well.
Tuple queries use the metadata section of the table file to find the index of the columns to be queried,
and those respective cols are changed in their respective rows.
How Different Joins are Implemented
-----------------------------------
Both of the first joins, which are inner joins, are implemented the same way.
Essentially, the data for both tables is stored in structs to make them easy to iterate through.
For inner joins, for every row in the first table that has the specified column name
that matches the second table's specified column name, the matching rows are combined printed.
For the left outer join, a similar technique is used, but if there was no match between the left table's
data and the right table's data, the left is still printed.
How Atomic Transactions are Implemented
---------------------------------------
Atomic transactions are implemented using the locking method. Essentially, when a transaction is started,
whatever table is being altered is copied and the copy is given the name <table-name>_LOCKED. There is a function
that checks whether a table is locked by looking for the table with this suffix, and this function is called before
any mutating changes are committed to a file. This way, if a file is locked by one process, it cannot be changed by another.
Also, this permits queries to the table while another process is altering it.