debug: search PROTOCOLO table and all CUP fields system-wide
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
942d68b75d
commit
fb81ddf263
+15
-6
@@ -21,14 +21,23 @@ async def find_cups(request: Request, user: dict = Depends(get_current_user)):
|
|||||||
|
|
||||||
results = {}
|
results = {}
|
||||||
|
|
||||||
ok1, err1, rows1 = fb.execute_query(
|
# 1. Buscar todas las tablas que tengan campo con "CUP" en nombre
|
||||||
"SELECT FIRST 3 rh.* FROM RELACION_HIMS rh "
|
ok0, _, rows0 = fb.execute_query(
|
||||||
"WHERE rh.CUPS_REF IS NOT NULL AND TRIM(rh.CUPS_REF)<>''"
|
"SELECT TRIM(f.RDB$RELATION_NAME) AS t, TRIM(f.RDB$FIELD_NAME) AS c "
|
||||||
|
"FROM RDB$RELATION_FIELDS f WHERE f.RDB$FIELD_NAME LIKE '%CUP%' "
|
||||||
|
"AND f.RDB$SYSTEM_FLAG = 0 ORDER BY 1,2"
|
||||||
)
|
)
|
||||||
results["relacion_hims_cups"] = list(rows1) if ok1 else f"error: {err1}"
|
results["todos_campos_cup"] = list(rows0) if ok0 else []
|
||||||
|
|
||||||
ok2, err2, rows2 = fb.execute_query("SELECT FIRST 1 rh.* FROM RELACION_HIMS rh")
|
# 2. Tabla PROTOCOLO - primera fila
|
||||||
results["relacion_hims_fila"] = rows2[0] if (ok2 and rows2) else f"error: {err2}"
|
ok1, err1, rows1 = fb.execute_query("SELECT FIRST 1 p.* FROM PROTOCOLO p")
|
||||||
|
results["protocolo_fila"] = rows1[0] if (ok1 and rows1) else f"error: {err1}"
|
||||||
|
|
||||||
|
# 3. PROTOCOLO para CH4
|
||||||
|
ok2, err2, rows2 = fb.execute_query(
|
||||||
|
"SELECT FIRST 1 p.* FROM PROTOCOLO p WHERE TRIM(p.CODIGO) = 'CH4'"
|
||||||
|
)
|
||||||
|
results["protocolo_ch4"] = rows2[0] if (ok2 and rows2) else f"error: {err2}"
|
||||||
|
|
||||||
fb.disconnect()
|
fb.disconnect()
|
||||||
return JSONResponse(results)
|
return JSONResponse(results)
|
||||||
|
|||||||
Reference in New Issue
Block a user