//----------------------------------------------------------------------- // // Copyright (c) Microsoft Corporation. // //----------------------------------------------------------------------- namespace Microsoft.Isam.Esent.Interop { using System; using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Runtime.InteropServices; /// /// The native version of the JET_RETINFO structure. /// [StructLayout(LayoutKind.Sequential)] [SuppressMessage("Microsoft.StyleCop.CSharp.NamingRules", "SA1305:FieldNamesMustNotUseHungarianNotation", Justification = "This should match the unmanaged API, which isn't capitalized.")] [SuppressMessage( "Microsoft.StyleCop.CSharp.NamingRules", "SA1307:AccessibleFieldsMustBeginWithUpperCaseLetter", Justification = "This should match the unmanaged API, which isn't capitalized.")] internal struct NATIVE_RETINFO { /// /// The size of a NATIVE_RETINFO structure. /// public static readonly int Size = Marshal.SizeOf(typeof(NATIVE_RETINFO)); /// /// Size of this structure. /// public uint cbStruct; /// /// Offset of the long value to retrieve. /// public uint ibLongValue; /// /// Itag sequence to retrieve. /// public uint itagSequence; /// /// Returns the columnid of the next tagged column. /// public uint columnidNextTagged; } /// /// Contains optional input and output parameters for JetRetrieveColumn. /// [SuppressMessage( "Microsoft.StyleCop.CSharp.NamingRules", "SA1300:ElementMustBeginWithUpperCaseLetter", Justification = "This should match the unmanaged API, which isn't capitalized.")] public class JET_RETINFO : IContentEquatable, IDeepCloneable { /// /// Gets or sets the offset to the first byte to be retrieved from a column of /// type , or . /// public int ibLongValue { get; set; } /// /// Gets or sets the sequence number of value in a multi-valued column. /// The array of values is one-based. The first value is /// sequence 1, not 0. If the record column has only one value then /// 1 should be passed as the itagSequence. /// public int itagSequence { get; set; } /// /// Gets the columnid of the retrieved tagged, multi-valued or /// sparse, column when all tagged columns are retrieved by passing /// 0 as the columnid to JetRetrieveColumn. /// public JET_COLUMNID columnidNextTagged { get; internal set; } /// /// Returns a that represents the current . /// /// /// A that represents the current . /// public override string ToString() { return string.Format( CultureInfo.InvariantCulture, "JET_RETINFO(ibLongValue={0},itagSequence={1})", this.ibLongValue, this.itagSequence); } /// /// Returns a value indicating whether this instance is equal /// to another instance. /// /// An instance to compare with this instance. /// True if the two instances are equal. public bool ContentEquals(JET_RETINFO other) { if (null == other) { return false; } return this.ibLongValue == other.ibLongValue && this.itagSequence == other.itagSequence && this.columnidNextTagged == other.columnidNextTagged; } /// /// Returns a deep copy of the object. /// /// A deep copy of the object. public JET_RETINFO DeepClone() { return (JET_RETINFO)this.MemberwiseClone(); } /// /// Get a NATIVE_RETINFO structure representing the object. /// /// A NATIVE_RETINFO whose members match the class. internal NATIVE_RETINFO GetNativeRetinfo() { var retinfo = new NATIVE_RETINFO(); retinfo.cbStruct = checked((uint)NATIVE_RETINFO.Size); retinfo.ibLongValue = checked((uint)this.ibLongValue); retinfo.itagSequence = checked((uint)this.itagSequence); return retinfo; } /// /// Sets the fields of the object from a NATIVE_RETINFO structure. /// /// The NATIVE_RETINFO which will be used to set the fields. internal void SetFromNativeRetinfo(NATIVE_RETINFO value) { this.ibLongValue = checked((int)value.ibLongValue); this.itagSequence = checked((int)value.itagSequence); var columnid = new JET_COLUMNID { Value = value.columnidNextTagged }; this.columnidNextTagged = columnid; } } }