//-----------------------------------------------------------------------
//
// 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_INDEXLIST 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_INDEXLIST
{
///
/// Size of the structure.
///
public uint cbStruct;
///
/// Tableid of the temporary table.
///
public IntPtr tableid;
///
/// Number of records in the table.
///
public uint cRecord;
///
/// Id of the column containing the name of the index.
///
public uint columnidindexname;
///
/// Id of the column containing index options.
///
public uint columnidgrbitIndex;
///
/// Id of the column containing the number of unique keys in the index.
/// This is updated by "Api.JetComputeStats".
///
public uint columnidcKey;
///
/// Id of the column containing the number of entries in the index.
/// This is updated by "Api.JetComputeStats".
///
public uint columnidcEntry;
///
/// Id of the column containing the number of pages in the index.
/// This is updated by "Api.JetComputeStats".
///
public uint columnidcPage;
///
/// Id of the column containing the number of columns in the index
/// definition.
///
public uint columnidcColumn;
///
/// Id of the column storing the index of this column in the index key.
///
public uint columnidiColumn;
///
/// Id of the column containing the columnid.
///
public uint columnidcolumnid;
///
/// Id of the column containing the column type.
///
public uint columnidcoltyp;
///
/// Id of the column containing the country code (obsolete).
///
[Obsolete("Deprecated")]
public uint columnidCountry;
///
/// Id of the column containing the LCID of the index.
///
public uint columnidLangid;
///
/// Id of the column containing the code page of the index.
///
public uint columnidCp;
///
/// Obsolete. Ignored.
///
[Obsolete("Deprecated")]
public uint columnidCollate;
///
/// Id of the column giving the column options.
///
public uint columnidgrbitColumn;
///
/// Id of the column giving the column name.
///
public uint columnidcolumnname;
///
/// Id of the column giving the LCMapString options.
///
public uint columnidLCMapFlags;
}
///
/// Information about a temporary table containing information
/// about all indexes for a given table.
///
[SuppressMessage(
"Microsoft.StyleCop.CSharp.NamingRules",
"SA1300:ElementMustBeginWithUpperCaseLetter",
Justification = "This should match the unmanaged API, which isn't capitalized.")]
public sealed class JET_INDEXLIST
{
///
/// Gets tableid of the temporary table. This should be closed
/// when the table is no longer needed.
///
public JET_TABLEID tableid { get; internal set; }
///
/// Gets the number of records in the temporary table.
///
public int cRecord { get; internal set; }
///
/// Gets the columnid of the column in the temporary table which
/// stores the name of the index.
/// The column is of type .
///
public JET_COLUMNID columnidindexname { get; internal set; }
///
/// Gets the columnid of the column in the temporary table which
/// stores the the grbits used on the index. See .
/// The column is of type .
///
public JET_COLUMNID columnidgrbitIndex { get; internal set; }
///
/// Gets the columnid of the column in the temporary table which
/// stores the number of unique keys in the index.
/// This value is not current and is only is updated by "Api.JetComputeStats".
/// The column is of type .
///
public JET_COLUMNID columnidcKey { get; internal set; }
///
/// Gets the columnid of the column in the temporary table which
/// stores the number of entries in the index.
/// This value is not current and is only is updated by "Api.JetComputeStats".
/// The column is of type .
///
public JET_COLUMNID columnidcEntry { get; internal set; }
///
/// Gets the columnid of the column in the temporary table which
/// stores the number of pages in the index.
/// This value is not current and is only is updated by "Api.JetComputeStats".
/// The column is of type .
///
public JET_COLUMNID columnidcPage { get; internal set; }
///
/// Gets the columnid of the column in the temporary table which
/// stores the number of columns in the index key.
/// The column is of type .
///
public JET_COLUMNID columnidcColumn { get; internal set; }
///
/// Gets the columnid of the column in the temporary table which
/// stores the index of of this column in the index key.
/// The column is of type .
///
public JET_COLUMNID columnidiColumn { get; internal set; }
///
/// Gets the columnid of the column in the temporary table which
/// stores the columnid of the column being indexed.
/// The column is of type .
///
public JET_COLUMNID columnidcolumnid { get; internal set; }
///
/// Gets the columnid of the column in the temporary table which
/// stores the column type of the column being indexed.
/// The column is of type .
///
public JET_COLUMNID columnidcoltyp { get; internal set; }
///
/// Gets the columnid of the column in the temporary table which
/// stores the language id (LCID) of the index.
/// The column is of type .
///
public JET_COLUMNID columnidLangid { get; internal set; }
///
/// Gets the columnid of the column in the temporary table which
/// stores the code page of the indexed column.
/// The column is of type .
///
public JET_COLUMNID columnidCp { get; internal set; }
///
/// Gets the columnid of the column in the temporary table which
/// stores the grbit that apply to the indexed column. See .
/// The column is of type .
///
public JET_COLUMNID columnidgrbitColumn { get; internal set; }
///
/// Gets the columnid of the column in the temporary table which
/// stores the grbit that apply to the indexed column. See .
/// The column is of type .
///
public JET_COLUMNID columnidcolumnname { get; internal set; }
///
/// Gets the columnid of the column in the temporary table which
/// stores the unicode normalization flags for the index.
/// The column is of type .
///
public JET_COLUMNID columnidLCMapFlags { get; internal set; }
///
/// Returns a that represents the current .
///
///
/// A that represents the current .
///
public override string ToString()
{
return string.Format(
CultureInfo.InvariantCulture,
"JET_INDEXLIST(0x{0:x},{1} records)",
this.tableid,
this.cRecord);
}
///
/// Sets the fields of the object from a native JET_INDEXLIST struct.
///
///
/// The native indexlist to set the values from.
///
internal void SetFromNativeIndexlist(NATIVE_INDEXLIST value)
{
this.tableid = new JET_TABLEID { Value = value.tableid };
this.cRecord = checked((int)value.cRecord);
this.columnidindexname = new JET_COLUMNID { Value = value.columnidindexname };
this.columnidgrbitIndex = new JET_COLUMNID { Value = value.columnidgrbitIndex };
this.columnidcKey = new JET_COLUMNID { Value = value.columnidcKey };
this.columnidcEntry = new JET_COLUMNID { Value = value.columnidcEntry };
this.columnidcPage = new JET_COLUMNID { Value = value.columnidcPage };
this.columnidcColumn = new JET_COLUMNID { Value = value.columnidcColumn };
this.columnidiColumn = new JET_COLUMNID { Value = value.columnidiColumn };
this.columnidcolumnid = new JET_COLUMNID { Value = value.columnidcolumnid };
this.columnidcoltyp = new JET_COLUMNID { Value = value.columnidcoltyp };
this.columnidLangid = new JET_COLUMNID { Value = value.columnidLangid };
this.columnidCp = new JET_COLUMNID { Value = value.columnidCp };
this.columnidgrbitColumn = new JET_COLUMNID { Value = value.columnidgrbitColumn };
this.columnidcolumnname = new JET_COLUMNID { Value = value.columnidcolumnname };
this.columnidLCMapFlags = new JET_COLUMNID { Value = value.columnidLCMapFlags };
}
}
}