//-----------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation.
//
//-----------------------------------------------------------------------
namespace Microsoft.Isam.Esent.Interop.Vista
{
///
/// ESENT APIs that were first supported in Windows Vista.
///
public static class VistaApi
{
///
/// Retrieves information about a column in a table.
///
/// The session to use.
/// The database that contains the table.
/// The name of the table containing the column.
/// The ID of the column.
/// Filled in with information about the columns in the table.
public static void JetGetColumnInfo(
JET_SESID sesid,
JET_DBID dbid,
string tablename,
JET_COLUMNID columnid,
out JET_COLUMNBASE columnbase)
{
Api.Check(Api.Impl.JetGetColumnInfo(sesid, dbid, tablename, columnid, out columnbase));
}
#region JetGetTableColumnInfo overloads
///
/// Retrieves information about a table column.
///
/// The session to use.
/// The table containing the column.
/// The columnid of the column.
/// Filled in with information about the column.
public static void JetGetTableColumnInfo(
JET_SESID sesid,
JET_TABLEID tableid,
JET_COLUMNID columnid,
out JET_COLUMNBASE columnbase)
{
Api.Check(Api.Impl.JetGetTableColumnInfo(sesid, tableid, columnid, out columnbase));
}
#endregion
///
/// Creates a temporary table with a single index. A temporary table
/// stores and retrieves records just like an ordinary table created
/// using JetCreateTableColumnIndex. However, temporary tables are
/// much faster than ordinary tables due to their volatile nature.
/// They can also be used to very quickly sort and perform duplicate
/// removal on record sets when accessed in a purely sequential manner.
/// Also see
/// ,
/// .
///
///
/// Introduced in Windows Vista. Use
/// for earlier versions of Esent.
///
/// The session to use.
///
/// Description of the temporary table to create on input. After a
/// successful call, the structure contains the handle to the temporary
/// table and column identifications. Use
/// to free the temporary table when finished.
///
public static void JetOpenTemporaryTable(JET_SESID sesid, JET_OPENTEMPORARYTABLE temporarytable)
{
Api.Check(Api.Impl.JetOpenTemporaryTable(sesid, temporarytable));
}
///
/// Retrieves performance information from the database engine for the
/// current thread. Multiple calls can be used to collect statistics
/// that reflect the activity of the database engine on this thread
/// between those calls.
///
/// Returns the thread statistics data.
public static void JetGetThreadStats(out JET_THREADSTATS threadstats)
{
Api.Check(Api.Impl.JetGetThreadStats(out threadstats));
}
#if !MANAGEDESENT_ON_WSA
///
/// Selects a specific instance to be part of the snapshot session.
///
/// The snapshot identifier.
/// The instance to add to the snapshot.
/// Options for this call.
public static void JetOSSnapshotPrepareInstance(JET_OSSNAPID snapshot, JET_INSTANCE instance, SnapshotPrepareInstanceGrbit grbit)
{
Api.Check(Api.Impl.JetOSSnapshotPrepareInstance(snapshot, instance, grbit));
}
///
/// Enables log truncation for all instances that are part of the snapshot session.
///
///
/// This function should be called only if the snapshot was created with the
/// option. Otherwise, the snapshot
/// session ends after the call to .
///
/// The snapshot identifier.
/// Options for this call.
public static void JetOSSnapshotTruncateLog(JET_OSSNAPID snapshot, SnapshotTruncateLogGrbit grbit)
{
Api.Check(Api.Impl.JetOSSnapshotTruncateLog(snapshot, grbit));
}
///
/// Truncates the log for a specified instance during a snapshot session.
///
///
/// This function should be called only if the snapshot was created with the
/// option. Otherwise, the snapshot
/// session ends after the call to .
///
/// The snapshot identifier.
/// The instance to truncat the log for.
/// Options for this call.
public static void JetOSSnapshotTruncateLogInstance(JET_OSSNAPID snapshot, JET_INSTANCE instance, SnapshotTruncateLogGrbit grbit)
{
Api.Check(Api.Impl.JetOSSnapshotTruncateLogInstance(snapshot, instance, grbit));
}
///
/// Retrieves the list of instances and databases that are part of the
/// snapshot session at any given moment.
///
/// The identifier of the snapshot session.
/// Returns the number of instances.
/// Returns information about the instances.
/// Options for this call.
public static void JetOSSnapshotGetFreezeInfo(
JET_OSSNAPID snapshot,
out int numInstances,
out JET_INSTANCE_INFO[] instances,
SnapshotGetFreezeInfoGrbit grbit)
{
Api.Check(Api.Impl.JetOSSnapshotGetFreezeInfo(snapshot, out numInstances, out instances, grbit));
}
///
/// Notifies the engine that the snapshot session finished.
///
/// The identifier of the snapshot session.
/// Snapshot end options.
public static void JetOSSnapshotEnd(JET_OSSNAPID snapshot, SnapshotEndGrbit grbit)
{
Api.Check(Api.Impl.JetOSSnapshotEnd(snapshot, grbit));
}
///
/// Retrieves information about an instance.
///
/// The instance to get information about.
/// Retrieved information.
/// The type of information to retrieve.
public static void JetGetInstanceMiscInfo(JET_INSTANCE instance, out JET_SIGNATURE signature, JET_InstanceMiscInfo infoLevel)
{
Api.Check(Api.Impl.JetGetInstanceMiscInfo(instance, out signature, infoLevel));
}
#endif // !MANAGEDESENT_ON_WSA
///
/// Initialize the ESENT database engine.
///
///
/// The instance to initialize. If an instance hasn't been
/// allocated then a new one is created and the engine
/// will operate in single-instance mode.
///
///
/// Additional recovery parameters for remapping databases during
/// recovery, position where to stop recovery at, or recovery status.
///
///
/// Initialization options.
///
///
/// A warning code.
///
public static JET_wrn JetInit3(ref JET_INSTANCE instance, JET_RSTINFO recoveryOptions, InitGrbit grbit)
{
return Api.Check(Api.Impl.JetInit3(ref instance, recoveryOptions, grbit));
}
#if !MANAGEDESENT_ON_WSA // Not exposed in MSDK
///
/// Retrieves record size information from the desired location.
///
/// The session to use.
///
/// The cursor that will be used for the API call. The cursor must be
/// positioned on a record, or have an update prepared.
///
/// Returns the size of the record.
/// Call options.
public static void JetGetRecordSize(JET_SESID sesid, JET_TABLEID tableid, ref JET_RECSIZE recsize, GetRecordSizeGrbit grbit)
{
Api.Check(Api.Impl.JetGetRecordSize(sesid, tableid, ref recsize, grbit));
}
#endif // !MANAGEDESENT_ON_WSA
}
}