poolGetStateJson method

Map<String, dynamic>? poolGetStateJson(
  1. int poolId
)

Gets pool state as JSON (detailed metrics for monitoring).

Returns a map with keys: total_connections, idle_connections, active_connections, max_size, wait_count, wait_time_ms, max_wait_time_ms, avg_wait_time_ms. Returns null on failure.

Implementation

Map<String, dynamic>? poolGetStateJson(int poolId) {
  final data = callWithBuffer(
    (buf, bufLen, outWritten) =>
        _bindings.odbc_pool_get_state_json(poolId, buf, bufLen, outWritten),
    initialSize: 256,
  );
  if (data == null || data.isEmpty) return null;
  try {
    final json = utf8.decode(data);
    return jsonDecode(json) as Map<String, dynamic>;
  } on Object {
    return null;
  }
}