-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
62 lines (53 loc) · 2.02 KB
/
Copy pathmain.py
File metadata and controls
62 lines (53 loc) · 2.02 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import Parse
import constants
from UserLogin import UserLogin
from UserSignUp import UserSignUp
from termcolor import colored
import re
import QueryProcessor as qp
userLogsDir = "UserLogs/UserLogs.json"
def userLoginSignUp():
existing_member = input("Are you an existing member Y/N: ")
if existing_member.upper() == "Y" or existing_member.upper() == "N":
if existing_member.upper() == "Y":
user_Id = input("Please enter your user ID: ")
user_Pass = input("Please enter your password: ")
user_access = UserLogin(user_Id, user_Pass)
user_access.check()
if not user_access.login_status:
userLoginSignUp()
else:
user_Id = input("Please enter your user ID: ")
user_Pass = input("Please enter your password: ")
user_access = UserSignUp(user_Id, user_Pass)
user_access.signUp()
userLoginSignUp()
else:
print("\nPlease enter correct options Y/N: \n")
userLoginSignUp()
def main():
print(colored("\n#####################################################",'green'))
print(colored(" Welcome to Team-15 DataBase Management System ",'green'))
print(colored("#####################################################\n",'green'))
userLoginSignUp()
query = ""
database=""
queryProcessor=qp.QueryProcessor()
while not query.lower() == "quit":
query=input(constants.InputQuery)
if "use" in query.lower():
Parse.Parse.newDB=True
db_raw=re.compile(r'use\s(.*)\s*',re.IGNORECASE).findall(query)
database=db_raw[0]
query=input()
else:
database
query_type = Parse.Parse(database,query,queryProcessor)
val = query_type.check_query()
if val == -1:
print(colored("Incorrect Query", 'red'))
elif val == 0:
break
print("\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Thanks!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
if __name__ == "__main__":
main()