getArrayValue method

dynamic getArrayValue(
  1. int index
)

Get value at a specific position

The data buffer was allocated by ODPI-C during variable creation and is accessed directly using pointer arithmetic.

Implementation

dynamic getArrayValue(int index) {
  _ensureNotDisposed();

  if (index < 0 || index >= _arraySize) {
    throw OracleException(
      'Index $index out of bounds (array size: $_arraySize)',
    );
  }

  // Access the data element at the specified index
  final data = Pointer<dpiData>.fromAddress(
    _dataPtr.address + index * sizeOf<dpiData>(),
  );

  return _getDataValue(data.ref);
}