SqlCursor is the enumerator used to iterate through the rows of a SqlResultSet.
Applications usually obtain a cursor implicitly through foreach, but it can also be used
directly for manual row-by-row iteration.
public class SqlCursor : IEnumerator<SqlTuple>, IEnumerator, IDisposable
{
// ===== PROPERTIES =====
public SqlTuple Current { get; }
object IEnumerator.Current { get; }
// ===== ITERATION METHODS =====
public bool MoveNext();
public void Reset();
// ===== LIFECYCLE METHODS =====
public void Close();
public void Dispose();
}
SqlCursor classSqlResultSet). Implements standard .NET enumerator interfaces for use with foreach loops and manual iteration.Current
SqlTuple at the cursor position. A meaningful current value is established by a successful call to MoveNext(). Before the first successful move the value is not initialized, and after MoveNext() returns false the last tuple remains available.IEnumerator.Current
object. It exposes the same current tuple as the typed Current property.MoveNext()
true if a tuple is available and updates Current to that tuple. Returns false when the end of the result set is reached.Reset()
Close()
Dispose().Dispose()
SqlResultSet and closes the native cursor handle. The parent result set can also dispose attached cursors as part of coordinated cleanup.foreach (SqlTuple row in resultSet) for the usual iteration pattern and automatic enumerator disposal. For manual iteration, obtain a cursor from SqlResultSet.GetEnumerator(), call MoveNext() in a loop, and read the current tuple from Current.Dispose() or use a using block to ensure timely cleanup. The SqlResultSet tracks attached cursors and closes them when the result set itself is disposed.SqlCursor instances are not thread-safe. Do not share a cursor across threads. Each thread should obtain its own cursor from the result set.SqlTuple returned by Current. Use SqlResultSet.ColumnNames and ColumnTypes to resolve column indices and perform safe type casting.Reset() is implemented as a no-op in the current C# wrapper. To iterate again from the beginning, create a new cursor by enumerating the parent SqlResultSet again.