//----------------------------------------------------------------------- // // Copyright (c) Microsoft Corporation. // //----------------------------------------------------------------------- namespace Microsoft.Isam.Esent.Interop { using System; using System.Globalization; /// /// The values for a given column as generated by Api.EnumerateColumns. /// public class EnumeratedColumn { /// /// Gets or sets the column ID of this set of column values. /// public JET_COLUMNID Id { get; set; } /// /// Gets or sets the status of this column id. /// /// /// /// public JET_err Error { get; set; } /// /// Gets or sets the status of this set of column values. /// /// /// /// /// /// public JET_wrn Warning { get; set; } /// /// Gets or sets the column values enumerated. /// /// /// This will be null if the column is null or the column values were not provided. /// public Value[] Values { get; set; } /// /// Returns a that represents the current . /// /// /// A that represents the current . /// public override string ToString() { return string.Format( CultureInfo.InvariantCulture, "EnumeratedColumn(0x{0:x}: {1} Values[{2}])", this.Id, this.Error != JET_err.Success ? this.Error.ToString() : this.Warning.ToString(), this.Values.Length); } /// /// A single column value. /// public class Value { /// /// Gets or sets the ordinal of this column value. /// /// /// The lowest valid ordinal is one. /// This is the same as the "itagSequence" of the column value. /// public int Ordinal { get; set; } /// /// Gets or sets the status of this column value. /// /// /// /// /// /// /// /// public JET_wrn Warning { get; set; } /// /// Gets or sets the column value as bytes. /// /// /// This will be null if the column is null or the column values were not provided. /// This will be truncated if Warning is . /// public byte[] Bytes { get; set; } /// /// Returns a that represents the current . /// /// /// A that represents the current . /// public override string ToString() { const int MaxLength = 16; return string.Format( CultureInfo.InvariantCulture, "EnumeratedColumn.Value({0}: {1} Bytes[{2}] = {3}{4}{5}{6})", this.Ordinal, this.Warning, this.Bytes.Length, '{', BitConverter.ToString(this.Bytes, 0, Math.Min(this.Bytes.Length, MaxLength)), this.Bytes.Length > MaxLength ? "..." : string.Empty, '}'); } } } }