diff --git a/aabook/src/alter_table.py b/aabook/src/alter_table.py index 1fdb849..06f4dee 100644 --- a/aabook/src/alter_table.py +++ b/aabook/src/alter_table.py @@ -67,11 +67,13 @@ def check_dirty_chapters(): # 检查脏数据 def update_dirty_chapters(): # 循环遍历 0 到 100 的数字 + total = 0 for i in range(100): table_name = f'{tbl_name_chapters_prefix}_{i}' 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' ") updated_rows = cursor.rowcount + total += updated_rows print(f"update {table_name}, affected rows: {updated_rows}") conn.commit() @@ -82,6 +84,8 @@ def update_dirty_chapters(): except sqlite3.Error as e: print(f"query error: {e}") + print(f"\n\ntotal update rows: {total}") + # 检查是否存在,已存在的先删除 def check_view_exist(view_name): cursor.execute("SELECT name FROM sqlite_master WHERE type='view' AND name=?", (view_name,))