getStmtCacheSize method

Future<int> getStmtCacheSize()

Get the current statement cache size.

Returns the maximum number of statements that can be cached by this connection. Statement caching improves performance by reusing prepared statements.

Returns: The statement cache size (number of statements).

Example:

final cacheSize = await connection.getStmtCacheSize();
print('Statement cache size: $cacheSize');
// Output: Statement cache size: 20

See also:

Implementation

Future<int> getStmtCacheSize() async {
  _ensureConnected();

  final cacheSize = _memoryManager.allocate<Uint32>(sizeOf<Uint32>());

  final result = _dpiOracle.dpiConn_getStmtCacheSize(
    _connectionPtr.value,
    cacheSize,
  );

  if (result == DPI_FAILURE) {
    throw OracleConnectionException('Failed to get statement cache size');
  }

  return cacheSize.value;
}