The C# SqlTuple Class

SqlTuple provides access to one row of an SQL query result. It is returned by SqlCursor while iterating a SqlResultSet, and it exposes the row values through indexed access by column number or column name.

For an overview see page SQL Classes

Class Definition

    public class SqlTuple
    {
        public int Count { get; }
        public object this[int i] { get; }
        public object this[string column] { get; }
    }

Member Descriptions

SqlTuple class
Represents one row returned by an SQL query. A tuple is produced by a SqlCursor and provides access to the values of the current row.
Count
Gets the number of columns in this tuple. For result-wide metadata such as column names and types, use the parent SqlResultSet.
this[int i]
Gets the value of the column at the specified zero-based index. The returned value is an object and should be cast according to the corresponding entry in SqlResultSet.ColumnTypes.
this[string column]
Gets the value of the column with the specified column name. This indexer resolves the name using SqlResultSet.GetColumnNo() and then accesses the value by index. It throws ArgumentException if the column name is not found.
Value Types
Tuple values are returned as boxed .NET values such as long, double, string, DateTime, decimal, byte[], Sequence, or remote-SQL sequence arrays, depending on the SQL column type and transport.
Column Name Access
Use the string indexer when code is easier to read with column names, and use the integer indexer when performance matters or when column indices are already known from SqlResultSet.ColumnNames and GetColumnNo().
Relationship To SqlResultSet
A tuple does not store independent result metadata. Column names, types, and column lookup services are provided by the parent SqlResultSet.
Relationship To SqlCursor
SqlCursor.Current returns the current tuple. Each successful MoveNext() call creates a new SqlTuple representing the newly selected row.
Resource Management
SqlTuple itself does not implement IDisposable. Keep the parent SqlCursor and SqlResultSet alive while reading tuple values. If a tuple value is itself a disposable object, such as Sequence, release that value according to its own lifecycle rules.
Typical Usage
Use foreach (SqlTuple row in resultSet) for normal traversal, then read values by index or by name, for example row[0] or row["price"].