//-----------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation.
//
//-----------------------------------------------------------------------
namespace Microsoft.Isam.Esent.Interop
{
///
/// Enumerate columns in a table specified by dbid and name.
///
internal sealed class TableIndexInfoEnumerator : IndexInfoEnumerator
{
///
/// The database containing the table.
///
private readonly JET_DBID dbid;
///
/// The name of the table.
///
private readonly string tablename;
///
/// Initializes a new instance of the class.
///
///
/// The session to use.
///
///
/// The database containing the table.
///
///
/// The name of the table.
///
public TableIndexInfoEnumerator(JET_SESID sesid, JET_DBID dbid, string tablename)
: base(sesid)
{
this.dbid = dbid;
this.tablename = tablename;
}
///
/// Open the table to be enumerated. This should set .
///
protected override void OpenTable()
{
JET_INDEXLIST indexlist;
Api.JetGetIndexInfo(this.Sesid, this.dbid, this.tablename, string.Empty, out indexlist, JET_IdxInfo.List);
this.Indexlist = indexlist;
this.TableidToEnumerate = this.Indexlist.tableid;
}
///
/// Retrieves information about indexes on a table.
///
/// The session to use.
/// The name of the index.
/// Filled in with information about indexes on the table.
/// The type of information to retrieve.
protected override void GetIndexInfo(
JET_SESID sesid,
string indexname,
out string result,
JET_IdxInfo infoLevel)
{
Api.JetGetIndexInfo(sesid, this.dbid, this.tablename, indexname, out result, infoLevel);
}
}
}