-
Notifications
You must be signed in to change notification settings - Fork 0
/
mysql.py
35 lines (34 loc) · 1.34 KB
/
mysql.py
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
import module
import pymysql
join = module.join()
GetColumn = module.GetColumn() # 增
delt = module.delt() # 删
Renewal = module.Renewal() # 改
Inquire = module.Inquire() # 查
host = input("请输入数据库地址")
user = input("请输入用户名")
password = input("请输入密码")
while True:
try:
print("1;增\n2;删\n3;改\n4;查")
i = int(input("选择功能"))
if 1 <= i <= 4:
library_name = input("请输入数据库名")
table_name = input("请输入表名")
join.join(host,user,password,library_name)
if i == 1:
GetColumn.GetColumn(join.cursor, join.conn, table_name)
module.close(join.cursor, join.conn)
elif i == 2:
delt.deltf(join.cursor, join.conn, table_name)
module.close(join.cursor, join.conn)
elif i == 3:
Renewal.Renewalf(join.cursor, join.conn, table_name)
module.close(join.cursor, join.conn)
elif i == 4:
Inquire.run(join.cursor, join.conn, table_name)
module.close(join.cursor, join.conn)
else:
print("输入的数字不在1到4之间")
except ValueError:
print("您输入的不是数字,请再次尝试输入!!")