29 lines
598 B
Python
29 lines
598 B
Python
#!/usr/bin/env python
|
|
# -*- coding: utf-8 -*-
|
|
"""检查work_results表中的记录"""
|
|
|
|
import sqlite3
|
|
|
|
conn = sqlite3.connect('wrench.db')
|
|
conn.row_factory = sqlite3.Row
|
|
cursor = conn.cursor()
|
|
|
|
# 获取表结构
|
|
cursor.execute('PRAGMA table_info(work_results)')
|
|
cols = [row[1] for row in cursor.fetchall()]
|
|
print("表字段:", cols)
|
|
|
|
# 获取最新记录
|
|
cursor.execute('SELECT * FROM work_results ORDER BY id DESC LIMIT 1')
|
|
row = cursor.fetchone()
|
|
|
|
if row:
|
|
print("\n最新一条记录:")
|
|
for col in cols:
|
|
print(f" {col}: {row[col]}")
|
|
else:
|
|
print("\n无记录")
|
|
|
|
conn.close()
|
|
|