#!/usr/bin/env python3
"""
查询指定 rowid 的 pub 值
"""

import sqlite3

db_path = r'\\ll\D\xtrssvjj\dpd.db'

try:
    conn = sqlite3.connect(db_path, timeout=30.0)
    
    # 查询 rowid=282364 的记录
    cursor = conn.execute('SELECT pub, name FROM ads WHERE rowid = ?', (282364,))
    row = cursor.fetchone()
    
    if row:
        pub = row[0]
        name = row[1] or ''
        print(f"rowid=282364")
        print(f"pub 值: {pub}")
        print(f"name: {name[:50]}")
        
        # 检查是否符合条件
        if pub in (3, 4):
            print("✓ 符合 '可发表+待发表' 条件 (pub=3或4)")
        else:
            print(f"✗ 不符合条件，需要 pub=3或4，当前pub={pub}")
    else:
        print("记录不存在")
    
    conn.close()
    
except Exception as e:
    print(f"查询失败: {e}")
    import traceback
    traceback.print_exc()
