添加了更多的主题, 修复了输入不存在主题时报错

This commit is contained in:
MarkusJoe
2022-02-09 16:20:53 +08:00
parent 494cc7fea2
commit baf99a905c
317 files changed
+111 -324

No files matched your search

BIN
View File
Binary file not shown.
+16 -2
View File
@@ -12,7 +12,7 @@ import sqlite3
"""
def insert_data(name: str):
def insert_data(name: str) -> None:
"""
插入数据
:param name:
@@ -50,7 +50,7 @@ def fetch_data(name: str) -> int:
return 0
def update_data(name: str, times: int):
def update_data(name: str, times: int) -> None:
"""
更新数据
:param name:
@@ -62,6 +62,20 @@ def update_data(name: str, times: int):
conn.commit()
def fetch_table() -> list:
"""
返回已有主题列表
:return:
"""
lst = []
conn_temp = sqlite3.connect('./bin/assets/theme.db', check_same_thread=False)
cursor_temp = conn_temp.cursor()
cursor_temp.execute("select * from sqlite_master where type='table'")
for i in cursor_temp.fetchall():
lst.append(i[1])
return lst
if __name__ != '__main__':
conn = sqlite3.connect('./db/data.db', check_same_thread=False)
cursor = conn.cursor()