setDbOp method

Future<void> setDbOp(
  1. String dbOp
)

Set database operation name for end-to-end tracing.

Sets the current database operation name for tracing purposes. Available in Oracle Database 12c and later.

Parameters:

  • dbOp: Database operation name

Example:

await connection.setDbOp('CUSTOMER_LOOKUP');
await connection.query('SELECT * FROM customers WHERE id = :1', params: [id]);

See also:

Implementation

Future<void> setDbOp(String dbOp) async {
  _ensureConnected();

  final (dbOpNative, dbOpLen) = StringUtils.toNativeUtf8WithLength(dbOp, _memoryManager);

  final result = _dpiOracle.dpiConn_setDbOp(
    _connectionPtr.value,
    dbOpNative,
    dbOpLen,
  );

  if (result == DPI_FAILURE) {
    throw OracleConnectionException('Failed to set database operation');
  }
}