Archived
添加了更多的主题, 修复了输入不存在主题时报错
This commit is contained in:
317 files changed
+111
-324
No files matched your search
BIN
Binary file not shown.
@@ -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()
|
||||
Reference in New Issue
Block a user