-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.py
More file actions
40 lines (37 loc) · 2.17 KB
/
Copy pathmain.py
File metadata and controls
40 lines (37 loc) · 2.17 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
39
40
import sys
sys.path.append("./Query_Processor")
sys.path.append("./Query_Processor/Query_Optimizer")
sys.path.append("./Query_Processor/Storage_Manager")
sys.path.append("./Query_Processor/Concurrency_Control_Manager")
from Query_Processor.QueryProcessor import QueryProcessor
from Query_Processor.utils.result import ExecutionResult, display_result
if __name__ == "__main__":
base_path = "./storage"
query_processor = QueryProcessor(base_path)
print(r""" $$\ $$\ $$\ $$$$$$\ $$$$$$\ $$\ """)
print(r""" $$ | $$ | $$ | $$ __$$\ $$ __$$\ $$ | """)
print(r""" $$ |$$ / $$$$$$\ $$\ $$\ $$\ $$\ $$\ $$ | $$$$$$\ $$ / \__|$$ / $$ |$$ | """)
print(r""" $$$$$ / \____$$\ $$ | $$ | $$ |$$ | $$ |$$ | \____$$\ \$$$$$$\ $$ | $$ |$$ | """)
print(r""" $$ $$< $$$$$$$ |$$ | $$ | $$ |$$ | $$ |$$ | $$$$$$$ | \____$$\ $$ | $$ |$$ | """)
print(r""" $$ |\$$\ $$ __$$ |$$ | $$ | $$ |$$ | $$ |$$ |$$ __$$ |$$\ $$ |$$ $$\$$ |$$ | """)
print(r""" $$ | \$$\\$$$$$$$ |\$$$$$\$$$$ |\$$$$$$ |$$ |\$$$$$$$ |\$$$$$$ |\$$$$$$ / $$$$$$$$\ """)
print(r""" \__| \__|\_______| \_____\____/ \______/ \__| \_______| \______/ \___$$$\ \________|""")
print(r""" \___| """)
print(" . . . . . . . . . . . . . . . ")
print("_.` `._.` `._.` `._.` `._.` `._.` `._.` `._.` `._.` `._.` `._.` `._.` `._.` `._.` `._.` `._")
print("\n")
print("Welcome to KawulaSQL!")
print("Enter your SQL query or type 'exit' to quit.\n")
while True:
query = input("[KawulaSQL] >>> ")
if query.lower() == "exit":
print("Exiting KawulaSQL. Goodbye!")
break
try:
result = query_processor.process_query(query)
if isinstance(result, ExecutionResult):
display_result(result)
else:
print("Unexpected result type.")
except Exception as e:
print(f"Error processing query: {str(e)}")