getStatistics method
Get pool statistics
Implementation
Future<PoolStatistics> getStatistics() async {
_ensureNotDisposed();
final openCount = _memoryManager.allocate<Uint32>(sizeOf<Uint32>());
final busyCount = _memoryManager.allocate<Uint32>(sizeOf<Uint32>());
var result = _dpiOracle.dpiPool_getOpenCount(_poolPtr.value, openCount);
if (result == DPI_FAILURE) {
throw OraclePoolException('Failed to get open count');
}
result = _dpiOracle.dpiPool_getBusyCount(_poolPtr.value, busyCount);
if (result == DPI_FAILURE) {
throw OraclePoolException('Failed to get busy count');
}
return PoolStatistics(
openConnections: openCount.value,
busyConnections: busyCount.value,
maxOpenConnections: _poolConfig.poolMax,
availableConnections: openCount.value - busyCount.value,
);
}