Update OracleSQL.py

This commit is contained in:
Joshua Perry 2022-03-21 23:04:24 +00:00 committed by GitHub
parent 739329605e
commit 6aa823f7a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 8 deletions

View File

@ -7,9 +7,9 @@ os.chdir("C://Users/joshu/Documents/Uni/CSY1026/scripts/")
runFlag = True runFlag = True
while runFlag: while runFlag:
choice = int(input("\nWhich account would you like to log into?\n1) Normal\n2) Coursework\n>")) account_choice = int(input("\nWhich account would you like to log into?\n1) Normal\n2) Coursework\n>"))
if (choice == 1 or choice == 2): if (account_choice == 1 or account_choice == 2):
runFlag = False runFlag = False
else: else:
print("\nIncorrect Input\n") print("\nIncorrect Input\n")
@ -47,13 +47,9 @@ while runFlag:
elif (command == "run"): elif (command == "run"):
os.chdir("C://Oracle12c/") os.chdir("C://Oracle12c/")
run_time = "" run_time = sp.Popen(f"sqlplus.exe {accounts[account_choice-1]}@student/password", stdout=sp.PIPE, stdin=sp.PIPE, stderr=sp.PIPE)
if (choice == 1 or choice == 2):
run_time = sp.Popen(f"sqlplus.exe {accounts[choice-1]}@student/password", stdout=sp.PIPE, stdin=sp.PIPE, stderr=sp.PIPE)
print("\n"+run_time.communicate(f"@C://Users/joshu/Documents/Uni/CSY1026/scripts/{current_file}.sql\n".encode())[0].decode()) print("\n"+run_time.communicate(f"@C://Users/joshu/Documents/Uni/CSY1026/scripts/{current_file}.sql\n".encode())[0].decode())
input("Press Enter to continue...\n") input("Press Enter to continue...\n")
else: else:
print("\nIncorrect Input\n") print("\nIncorrect Input\n")
input("Press Enter to continue...\n") input("Press Enter to continue...\n")