executeStatement method
Execute the prepared statement (internal method, also used by callproc)
Implementation
Future<void> executeStatement() async {
if (_executed) {
return;
}
final colNumber = _memoryManager.allocate<Uint32>(sizeOf<Uint32>());
final errorInfo = _memoryManager.allocate<dpiErrorInfo>(sizeOf<dpiErrorInfo>());
final result = _dpiOracle.dpiStmt_execute(
_statementPtr.value,
0, // mode
colNumber,
);
if (result == DPI_FAILURE) {
_dpiOracle.dpiContext_getError(_context, errorInfo);
final errorMsg = StringUtils.fromNativeUtf8(errorInfo.ref.message.cast<Char>());
final errorCode = errorInfo.ref.code;
throw OracleStatementException(
'Failed to execute statement',
errorCode: errorCode,
errorMessage: errorMsg,
sql: _sql,
);
}
_executed = true;
_columnCount = colNumber.value;
// Get rows affected for DML statements
final rowCount = _memoryManager.allocate<Uint64>(sizeOf<Uint64>());
_dpiOracle.dpiStmt_getRowCount(_statementPtr.value, rowCount);
_rowsAffected = rowCount.value;
}