modify scripts
This commit is contained in:
@ -67,11 +67,13 @@ def check_dirty_chapters():
|
|||||||
# 检查脏数据
|
# 检查脏数据
|
||||||
def update_dirty_chapters():
|
def update_dirty_chapters():
|
||||||
# 循环遍历 0 到 100 的数字
|
# 循环遍历 0 到 100 的数字
|
||||||
|
total = 0
|
||||||
for i in range(100):
|
for i in range(100):
|
||||||
table_name = f'{tbl_name_chapters_prefix}_{i}'
|
table_name = f'{tbl_name_chapters_prefix}_{i}'
|
||||||
try:
|
try:
|
||||||
cursor.execute(f"update {table_name} set has_content = 0 WHERE updated_at >= '2025-03-23 10:20:00' and updated_at <= '2025-03-23 11:20:00' ")
|
cursor.execute(f"update {table_name} set has_content = 0 WHERE updated_at >= '2025-03-23 10:20:00' and updated_at <= '2025-03-23 11:20:00' ")
|
||||||
updated_rows = cursor.rowcount
|
updated_rows = cursor.rowcount
|
||||||
|
total += updated_rows
|
||||||
print(f"update {table_name}, affected rows: {updated_rows}")
|
print(f"update {table_name}, affected rows: {updated_rows}")
|
||||||
|
|
||||||
conn.commit()
|
conn.commit()
|
||||||
@ -82,6 +84,8 @@ def update_dirty_chapters():
|
|||||||
except sqlite3.Error as e:
|
except sqlite3.Error as e:
|
||||||
print(f"query error: {e}")
|
print(f"query error: {e}")
|
||||||
|
|
||||||
|
print(f"\n\ntotal update rows: {total}")
|
||||||
|
|
||||||
# 检查是否存在,已存在的先删除
|
# 检查是否存在,已存在的先删除
|
||||||
def check_view_exist(view_name):
|
def check_view_exist(view_name):
|
||||||
cursor.execute("SELECT name FROM sqlite_master WHERE type='view' AND name=?", (view_name,))
|
cursor.execute("SELECT name FROM sqlite_master WHERE type='view' AND name=?", (view_name,))
|
||||||
|
|||||||
Reference in New Issue
Block a user