scroll method

Future<void> scroll(
  1. int mode, {
  2. int offset = 0,
})

Scroll to a specific row (for scrollable cursors)

Parameters:

  • mode: Scroll mode (DPI_MODE_FETCH_*)
  • offset: Offset from the mode position

Implementation

Future<void> scroll(int mode, {int offset = 0}) async {
  _ensureExecuted();

  final result = _dpiOracle.dpiStmt_scroll(
    _statementPtr.value,
    mode,
    offset,
    0, // rowCountOffset - typically 0
  );

  if (result == DPI_FAILURE) {
    final errorInfo = _memoryManager.allocate<dpiErrorInfo>(sizeOf<dpiErrorInfo>());
    _dpiOracle.dpiContext_getError(_context, errorInfo);
    final errorMsg = StringUtils.fromNativeUtf8(errorInfo.ref.message.cast<Char>());

    throw OracleStatementException(
      'Failed to scroll cursor',
      errorMessage: errorMsg,
      sql: _sql,
    );
  }
}