import pymysql

conn = pymysql.connect(host='85.215.144.168', user='asesoft', password='Pantera1', database='pastelerias', charset='utf8mb4')
with conn.cursor() as cur:
    print('--- Test 1: WITH BINARY (as currently in frm_Articulos line 348) ---')
    cur.execute("SELECT id, descripcion FROM ge_articulos WHERE UPPER(descripcion) LIKE BINARY UPPER('%TURRON%') LIMIT 5;")
    rows = cur.fetchall()
    print("Found with BINARY:", len(rows), rows)

    print('\n--- Test 2: WITHOUT BINARY (Standard LIKE) ---')
    cur.execute("SELECT id, descripcion FROM ge_articulos WHERE a.descripcion LIKE '%TURRON%' OR a.id LIKE '%TURRON%' LIMIT 5;" if False else "SELECT id, descripcion FROM ge_articulos WHERE descripcion LIKE '%TURRON%' LIMIT 5;")
    rows = cur.fetchall()
    print("Found WITHOUT BINARY:", len(rows), rows)

    print('\n--- Test 3: Search with accent TURRÓN against ge_articulos ---')
    cur.execute("SELECT id, descripcion FROM ge_articulos WHERE descripcion LIKE '%TURRÓN%' LIMIT 5;")
    rows = cur.fetchall()
    print("Found searching TURRÓN:", len(rows), rows)

conn.close()
