这是使用PyQT5作为UI的首次提交,将后端和UI合并到1个工程中,统一使用了Python,没有使用JS和HTML
This commit is contained in:
33
UI/reserved/check_db.py
Normal file
33
UI/reserved/check_db.py
Normal file
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import sqlite3
|
||||
import os
|
||||
|
||||
# 连接数据库
|
||||
db_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'models', 'dtmgtDb.db')
|
||||
print(f"数据库路径: {db_path}")
|
||||
|
||||
if os.path.exists(db_path):
|
||||
conn = sqlite3.connect(db_path)
|
||||
cursor = conn.cursor()
|
||||
|
||||
# 查询前10条记录的direction_codes
|
||||
cursor.execute('SELECT direction_codes FROM DUTList LIMIT 10')
|
||||
rows = cursor.fetchall()
|
||||
|
||||
print("前10条记录的direction_codes:")
|
||||
for i, row in enumerate(rows):
|
||||
print(f"{i+1}: {row[0]}")
|
||||
|
||||
# 查询包含非空direction_codes的记录
|
||||
cursor.execute('SELECT direction_codes FROM DUTList WHERE direction_codes IS NOT NULL AND direction_codes != "" LIMIT 10')
|
||||
rows = cursor.fetchall()
|
||||
|
||||
print("\n前10条非空direction_codes记录:")
|
||||
for i, row in enumerate(rows):
|
||||
print(f"{i+1}: {row[0]}")
|
||||
|
||||
conn.close()
|
||||
else:
|
||||
print("数据库文件不存在")
|
||||
Reference in New Issue
Block a user