import sqlite3
import os

db_path = r'\\ll\\d\\xtrssvjj\\dpd.db'
print('Checking database:', db_path)

if os.path.exists(db_path):
    print('Database exists')
    conn = sqlite3.connect(db_path)
    c = conn.cursor()
    
    # 检查数据库中的所有表
    c.execute("SELECT name FROM sqlite_master WHERE type='table';")
    print('\nTables in database:')
    for row in c.fetchall():
        print(row[0])
    
    # 检查ads表结构
    c.execute('PRAGMA table_info(ads)')
    print('\nads table structure:')
    for row in c.fetchall():
        print(row)
    
    # 检查srts表结构
    c.execute('PRAGMA table_info(srts)')
    print('\nsrts table structure:')
    for row in c.fetchall():
        print(row)
    
    # 查询srts表的前4条数据
    c.execute('SELECT idx, adname, en, start, end FROM srts ORDER BY idx LIMIT 4')
    rows = c.fetchall()
    print('\nFirst 4 rows in srts:')
    for row in rows:
        print(f'idx: {row[0]}, adname: "{row[1]}", en: "{row[2]}", start: {row[3]}, end: {row[4]}')
    
    # 查询ads表的前4条数据
    c.execute('SELECT * FROM ads LIMIT 4')
    rows = c.fetchall()
    print('\nFirst 4 rows in ads:')
    for row in rows:
        print(row)
    
    conn.close()
else:
    print('Database file not found')
    # 检查网络路径
    print('\nChecking network path...')
    if os.path.exists(r'\\ll'):
        print('\\ll exists')
    else:
        print('\\ll does not exist')