//----------------------------------------------------------------------- // // Copyright (c) Microsoft Corporation. // //----------------------------------------------------------------------- namespace Microsoft.Isam.Esent.Interop.Windows8 { using System; using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Runtime.InteropServices; using Microsoft.Isam.Esent.Interop.Implementation; /// /// Comparison operation for filter defined as . /// public enum JetRelop { /// /// Accept only rows which have column value equal to the given value. /// Equals = 0, /// /// Accept only rows which have columns whose prefix matches the given value. /// PrefixEquals, /// /// Accept only rows which have column value not equal to the given value. /// NotEquals, /// /// Accept only rows which have column value less than or equal a given value. /// LessThanOrEqual, /// /// Accept only rows which have column value less than a given value. /// LessThan, /// /// Accept only rows which have column value greater than or equal a given value. /// GreaterThanOrEqual, /// /// Accept only rows which have column value greater than a given value. /// GreaterThan, /// /// Accept only rows which have column value AND'ed with a given bitmask yielding zero. /// BitmaskEqualsZero, /// /// Accept only rows which have column value AND'ed with a given bitmask yielding non-zero. /// BitmaskNotEqualsZero, } /// /// The native version of the 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_INDEX_COLUMN { /// /// The column identifier for the column to check. /// public uint columnid; /// /// The comparison operation. /// public uint relop; /// /// A pointer to a value to compare. /// public IntPtr pvData; /// /// The size of value beginning at pvData, in bytes. /// public uint cbData; /// /// Options regarding this column value. /// public uint grbit; } /// /// Contains filter definition for and . /// [SuppressMessage( "Microsoft.StyleCop.CSharp.NamingRules", "SA1300:ElementMustBeginWithUpperCaseLetter", Justification = "This should match the unmanaged API, which isn't capitalized.")] public class JET_INDEX_COLUMN { /// /// Gets or sets the column identifier for the column to retrieve. /// public JET_COLUMNID columnid { get; set; } /// /// Gets or sets the filter comparison operation. /// public JetRelop relop { get; set; } /// /// Gets or sets the value to compare the column with. /// public byte[] pvData { get; set; } /// /// Gets or sets the option for this column comparison. /// public JetIndexColumnGrbit grbit { get; set; } /// /// Returns a that represents the current . /// /// /// A that represents the current . /// public override string ToString() { return string.Format(CultureInfo.InvariantCulture, "JET_INDEX_COLUMN(0x{0:x})", this.columnid); } /// /// Gets the NATIVE_indexcolumn structure that represents the object. /// /// GC handle collection to add any pinned handles. /// The NATIVE_indexcolumn structure. internal NATIVE_INDEX_COLUMN GetNativeIndexColumn(ref GCHandleCollection handles) { NATIVE_INDEX_COLUMN indexColumn = new NATIVE_INDEX_COLUMN(); indexColumn.columnid = this.columnid.Value; indexColumn.relop = (uint)this.relop; indexColumn.grbit = (uint)this.grbit; if (this.pvData != null) { indexColumn.pvData = handles.Add(this.pvData); indexColumn.cbData = (uint)this.pvData.Length; } return indexColumn; } } }