fix(agent): read JDBC blobs through Blob values

This commit is contained in:
t8y2 committed 2026-07-31 21:41:07 +08:00
1 parent 486a73ef09
commit ac49b28cab
2 files changed
+76 -8

No files matched your search

@@ -455,9 +455,11 @@ public final class JdbcExecutor {
case Types.BINARY:
case Types.VARBINARY:
case Types.LONGVARBINARY:
case Types.BLOB:
value = bytesToHex(rs.getBytes(index));
break;
case Types.BLOB:
value = blobResultValue(rs, index);
break;
case Types.SQLXML:
value = sqlXmlToString(rs.getSQLXML(index));
break;
@@ -474,9 +476,11 @@ public final class JdbcExecutor {
case Types.BINARY:
case Types.VARBINARY:
case Types.LONGVARBINARY:
case Types.BLOB:
value = bytesToHex(rs.getBytes(index));
break;
case Types.BLOB:
value = blobResultValue(rs, index);
break;
case Types.SQLXML:
value = sqlXmlToString(rs.getSQLXML(index));
break;
@@ -487,6 +491,17 @@ public final class JdbcExecutor {
return rs.wasNull() ? null : value;
}
private static Object blobResultValue(ResultSet rs, int index) throws SQLException {
Object value = rs.getObject(index);
if (value instanceof Blob || value instanceof byte[]) {
return normalizeResultValue(value);
}
if (value == null && rs.wasNull()) {
return null;
}
return bytesToHex(rs.getBytes(index));
}
public static Object normalizeResultValue(Object value) throws SQLException {
if (value == null) {
return null;