//-----------------------------------------------------------------------
//
// 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_COLUMNLIST 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_COLUMNLIST
{
///
/// Size of the structure.
///
public uint cbStruct;
///
/// Tableid of the temporary table.
///
public IntPtr tableid;
///
/// Number of records in the temporary table.
///
public uint cRecord;
///
/// Columnid of the presentation order column.
///
public uint columnidPresentationOrder;
///
/// Columnid of the name column.
///
public uint columnidcolumnname;
///
/// Columnid of the columnid column.
///
public uint columnidcolumnid;
///
/// Columnid of the coltyp column.
///
public uint columnidcoltyp;
///
/// Columnid of the country column.
///
public uint columnidCountry;
///
/// Columnid of the langid column.
///
public uint columnidLangid;
///
/// Columnid of the codepage column.
///
public uint columnidCp;
///
/// Columnid of the collation column.
///
public uint columnidCollate;
///
/// Columnid of the cbMax column.
///
public uint columnidcbMax;
///
/// Columnid of the grbit column.
///
public uint columnidgrbit;
///
/// Columnid of the default value column.
///
public uint columnidDefault;
///
/// Columnid of the base table name column.
///
public uint columnidBaseTableName;
///
/// Columnid of the base column name column.
///
public uint columnidBaseColumnName;
///
/// The column identifier of the name of the column definition.
///
public uint columnidDefinitionName;
}
///
/// Information about a temporary table containing information
/// about all columns for a given table.
///
[SuppressMessage(
"Microsoft.StyleCop.CSharp.NamingRules",
"SA1300:ElementMustBeginWithUpperCaseLetter",
Justification = "This should match the unmanaged API, which isn't capitalized.")]
public class JET_COLUMNLIST
{
///
/// 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 column.
///
public JET_COLUMNID columnidcolumnname { get; internal set; }
///
/// Gets the columnid of the column in the temporary table which
/// stores the id of the column.
///
public JET_COLUMNID columnidcolumnid { get; internal set; }
///
/// Gets the columnid of the column in the temporary table which
/// stores the type of the column.
///
public JET_COLUMNID columnidcoltyp { get; internal set; }
///
/// Gets the columnid of the column in the temporary table which
/// stores the code page of the column.
///
public JET_COLUMNID columnidCp { get; internal set; }
///
/// Gets the columnid of the column in the temporary table which
/// stores the maximum length of the column.
///
public JET_COLUMNID columnidcbMax { get; internal set; }
///
/// Gets the columnid of the column in the temporary table which
/// stores the grbit of the column.
///
public JET_COLUMNID columnidgrbit { get; internal set; }
///
/// Gets the columnid of the column in the temporary table which
/// stores the default value of the column.
///
public JET_COLUMNID columnidDefault { get; internal set; }
///
/// Gets the columnid of the column in the temporary table which
/// stores the name of the base table.
///
public JET_COLUMNID columnidBaseTableName { get; internal set; }
///
/// Returns a that represents the current .
///
///
/// A that represents the current .
///
public override string ToString()
{
return string.Format(
CultureInfo.InvariantCulture,
"JET_COLUMNLIST(0x{0:x},{1} records)",
this.tableid,
this.cRecord);
}
///
/// Sets the fields of the object from a native JET_COLUMNLIST struct.
///
///
/// The native columnlist to set the values from.
///
internal void SetFromNativeColumnlist(NATIVE_COLUMNLIST value)
{
this.tableid = new JET_TABLEID { Value = value.tableid };
this.cRecord = checked((int)value.cRecord);
this.columnidcolumnname = new JET_COLUMNID { Value = value.columnidcolumnname };
this.columnidcolumnid = new JET_COLUMNID { Value = value.columnidcolumnid };
this.columnidcoltyp = new JET_COLUMNID { Value = value.columnidcoltyp };
this.columnidCp = new JET_COLUMNID { Value = value.columnidCp };
this.columnidcbMax = new JET_COLUMNID { Value = value.columnidcbMax };
this.columnidgrbit = new JET_COLUMNID { Value = value.columnidgrbit };
this.columnidDefault = new JET_COLUMNID { Value = value.columnidDefault };
this.columnidBaseTableName = new JET_COLUMNID { Value = value.columnidBaseTableName };
}
}
}