CursorTokenLogin/check_db.py
2026-04-07 21:22:37 +08:00

35 lines
906 B
Python

import sqlite3
from pathlib import Path
home = Path.home()
db_path = home / "AppData" / "Roaming" / "Cursor" / "User" / "globalStorage" / "state.vscdb"
print(f"数据库路径: {db_path}")
print(f"存在: {db_path.exists()}\n")
conn = sqlite3.connect(db_path)
cursor = conn.cursor()
# 查看所有表
cursor.execute("SELECT name FROM sqlite_master WHERE type='table';")
tables = cursor.fetchall()
print("表列表:")
for table in tables:
print(f" - {table[0]}")
# 查看itemTable的结构
print("\nitemTable 结构:")
cursor.execute("PRAGMA table_info(itemTable);")
columns = cursor.fetchall()
for col in columns:
print(f" {col[1]} ({col[2]})")
# 查看itemTable的前几行数据
print("\nitemTable 数据示例:")
cursor.execute("SELECT * FROM itemTable LIMIT 20;")
rows = cursor.fetchall()
for row in rows:
print(f" {row[0]}: {row[1][:100] if row[1] else 'None'}...")
conn.close()