import sqlite3

# 连接数据库
conn = sqlite3.connect('qa_system.db')
cursor = conn.cursor()

# 查询所有用户
cursor.execute("SELECT id, username, email, hashed_password, is_admin, is_active FROM users")
users = cursor.fetchall()

print("数据库中的用户信息：")
print("-" * 80)
for user in users:
    print(f"ID: {user[0]}")
    print(f"用户名: {user[1]}")
    print(f"邮箱: {user[2]}")
    print(f"密码哈希: {user[3][:50]}...")
    print(f"是否管理员: {user[4]}")
    print(f"是否激活: {user[5]}")
    print("-" * 80)

print(f"\n总共 {len(users)} 个用户")

conn.close()
