main.py 847 Bytes
Newer Older
alexjubs's avatar
alexjubs committed
1
2
from utils import *

alexjubs's avatar
alexjubs committed
3
4
5
6
7
8
options_switchcase = {
	"insert" : insert_base_func,
	"modify" : modify_base_func,
	"delete" : delete_base_func,
	"get" : get_base_func
}
alexjubs's avatar
alexjubs committed
9

alexjubs's avatar
alexjubs committed
10
if __name__ == "__main__":
alexjubs's avatar
alexjubs committed
11
12
13
14
15
16
17
18
19
20
	print(
	'''
	Welcome to our ECE 356 final project client!

	insert - inserts an entry into the table
	modify - modifies an entry in a table by primary key
	delete - deletes a row (or mulitple rows) from the table
	get    - fetches a set of rows from a table in the DB
	''')

alexjubs's avatar
alexjubs committed
21
	while True:
alexjubs's avatar
sync    
alexjubs committed
22
		command = input("Command: ").split()
alexjubs's avatar
alexjubs committed
23
		if len(command) == 0: continue
alexjubs's avatar
alexjubs committed
24

alexjubs's avatar
alexjubs committed
25
		if command[0] not in options_switchcase:
alexjubs's avatar
alexjubs committed
26
			print(f"Error: command not in options. Options are:\n {list(options_switchcase.keys())}")
alexjubs's avatar
sync    
alexjubs committed
27
			continue
alexjubs's avatar
alexjubs committed
28

alexjubs's avatar
sync    
alexjubs committed
29
		if command[0] == "exit":
alexjubs's avatar
alexjubs committed
30
			exit("Terminating...")
alexjubs's avatar
sync    
alexjubs committed
31

alexjubs's avatar
alexjubs committed
32
		# pick the appropirate function given command[0]
alexjubs's avatar
alexjubs committed
33
		options_switchcase[command[0]](command)
alexjubs's avatar
sync    
alexjubs committed
34