35 lines
1.0 KiB
Python
35 lines
1.0 KiB
Python
import sqlite3
|
|
import os
|
|
|
|
BASE_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
|
|
L2_PATH = os.path.join(BASE_DIR, 'database', 'L2', 'L2_Main.sqlite')
|
|
|
|
def check_db_integrity():
|
|
print(f"Checking DB at: {L2_PATH}")
|
|
if not os.path.exists(L2_PATH):
|
|
print("CRITICAL: Database file does not exist!")
|
|
return
|
|
|
|
try:
|
|
conn = sqlite3.connect(L2_PATH)
|
|
cursor = conn.cursor()
|
|
|
|
# Check integrity
|
|
print("Running PRAGMA integrity_check...")
|
|
cursor.execute("PRAGMA integrity_check")
|
|
print(f"Integrity: {cursor.fetchone()}")
|
|
|
|
# Check specific user again
|
|
cursor.execute("SELECT steam_id_64, username FROM dim_players WHERE username LIKE '%jacky%'")
|
|
rows = cursor.fetchall()
|
|
print(f"Direct DB check found {len(rows)} rows matching '%jacky%':")
|
|
for r in rows:
|
|
print(r)
|
|
|
|
conn.close()
|
|
except Exception as e:
|
|
print(f"DB Error: {e}")
|
|
|
|
if __name__ == '__main__':
|
|
check_db_integrity()
|