//-----------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation.
//
//-----------------------------------------------------------------------
namespace Microsoft.Isam.Esent.Interop.Implementation
{
using System;
using Microsoft.Isam.Esent.Interop.Vista;
using Microsoft.Isam.Esent.Interop.Windows8;
///
/// This interface describes all the Windows8 methods which have a
/// P/Invoke implementation. Concrete instances of this interface provide
/// methods that call ESENT.
///
internal partial interface IJetApi
{
#region Transactions
///
/// Causes a session to enter a transaction or create a new save point in an existing
/// transaction.
///
/// The session to begin the transaction for.
/// An optional identifier supplied by the user for identifying the transaction.
/// Transaction options.
/// An error if the call fails.
int JetBeginTransaction3(JET_SESID sesid, long userTransactionId, BeginTransactionGrbit grbit);
///
/// Commits the changes made to the state of the database during the current save point
/// and migrates them to the previous save point. If the outermost save point is committed
/// then the changes made during that save point will be committed to the state of the
/// database and the session will exit the transaction.
///
/// The session to commit the transaction for.
/// Commit options.
/// Duration to commit lazy transaction.
/// Commit-id associated with this commit record.
/// An error if the call fails.
int JetCommitTransaction2(
JET_SESID sesid,
CommitTransactionGrbit grbit,
TimeSpan durableCommit,
out JET_COMMIT_ID commitId);
#endregion
///
/// Gets extended information about an error.
///
/// The error code about which to retrieve information.
/// Information about the specified error code.
/// An error code.
int JetGetErrorInfo(
JET_err error,
out JET_ERRINFOBASIC errinfo);
///
/// Resizes a currently open database.
///
/// The session to use.
/// The database to grow.
/// The desired size of the database, in pages.
/// The size of the database, in pages, after the call.
/// Resize options.
/// An error code.
int JetResizeDatabase(
JET_SESID sesid,
JET_DBID dbid,
int desiredPages,
out int actualPages,
ResizeDatabaseGrbit grbit);
#region DDL
///
/// Creates indexes over data in an ESE database.
///
/// The session to use.
/// The table to create the index on.
/// Array of objects describing the indexes to be created.
/// Number of index description objects.
/// An error code.
int JetCreateIndex4(
JET_SESID sesid,
JET_TABLEID tableid,
JET_INDEXCREATE[] indexcreates,
int numIndexCreates);
///
/// 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.
///
/// 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.
///
/// An error code.
int JetOpenTemporaryTable2(JET_SESID sesid, JET_OPENTEMPORARYTABLE temporarytable);
///
/// Creates a table, adds columns, and indices on that table.
///
/// The session to use.
/// The database to which to add the new table.
/// Object describing the table to create.
/// An error if the call fails.
int JetCreateTableColumnIndex4(
JET_SESID sesid,
JET_DBID dbid,
JET_TABLECREATE tablecreate);
#endregion
#region Session Parameters
///
/// Gets a parameter on the provided session state, used for the lifetime of this session or until reset.
///
/// The session to set the parameter on.
/// The ID of the session parameter to set, see
/// and .
/// A 32-bit integer to retrieve.
/// An error if the call fails.
int JetGetSessionParameter(JET_SESID sesid, JET_sesparam sesparamid, out int value);
///
/// Gets a parameter on the provided session state, used for the lifetime of this session or until reset.
///
/// The session to set the parameter on.
/// The ID of the session parameter to set, see
/// and .
/// A byte array to retrieve.
/// AThe length of the data array.
/// The actual size of the data field.
/// An error if the call fails.
int JetGetSessionParameter(
JET_SESID sesid,
JET_sesparam sesparamid,
byte[] data,
int length,
out int actualDataSize);
///
/// Sets a parameter on the provided session state, used for the lifetime of this session or until reset.
///
/// The session to set the parameter on.
/// The ID of the session parameter to set.
/// A 32-bit integer to set.
/// An error if the call fails.
int JetSetSessionParameter(JET_SESID sesid, JET_sesparam sesparamid, int value);
///
/// Sets a parameter on the provided session state, used for the lifetime of this session or until reset.
///
/// The session to set the parameter on.
/// The ID of the session parameter to set.
/// Data to set in this session parameter.
/// Size of the data provided.
/// An error if the call fails.
int JetSetSessionParameter(
JET_SESID sesid,
JET_sesparam sesparamid,
byte[] data,
int dataSize);
#endregion
#region Misc
///
/// If the records with the specified key ranges are not in the buffer
/// cache, then start asynchronous reads to bring the records into the
/// database buffer cache.
///
/// The session to use.
/// The table to issue the prereads against.
/// The key rangess to preread.
/// The index of the first key range in the array to read.
/// The maximum number of key ranges to preread.
/// Returns the number of keys actually preread.
/// List of column ids for long value columns to preread.
/// Preread options. Used to specify the direction of the preread.
///
/// An error if the call fails.
///
int JetPrereadIndexRanges(
JET_SESID sesid,
JET_TABLEID tableid,
JET_INDEX_RANGE[] indexRanges,
int rangeIndex,
int rangeCount,
out int rangesPreread,
JET_COLUMNID[] columnsPreread,
PrereadIndexRangesGrbit grbit);
///
/// If the records with the specified key ranges are not in the
/// buffer cache then start asynchronous reads to bring the records
/// into the database buffer cache.
///
/// The session to use.
/// The table to issue the prereads against.
/// The start of key ranges to preread.
/// The lengths of the start keys to preread.
/// The end of key rangess to preread.
/// The lengths of the end keys to preread.
/// The index of the first key range in the array to read.
/// The maximum number of key ranges to preread.
/// Returns the number of keys actually preread.
/// List of column ids for long value columns to preread.
/// Preread options. Used to specify the direction of the preread.
/// An error or warning.
int JetPrereadKeyRanges(
JET_SESID sesid,
JET_TABLEID tableid,
byte[][] keysStart,
int[] keyStartLengths,
byte[][] keysEnd,
int[] keyEndLengths,
int rangeIndex,
int rangeCount,
out int rangesPreread,
JET_COLUMNID[] columnsPreread,
PrereadIndexRangesGrbit grbit);
///
/// Set an array of simple filters for
///
/// The session to use for the call.
/// The cursor to position.
/// Simple record filters.
/// Move options.
/// An error if the call fails.
int JetSetCursorFilter(
JET_SESID sesid,
JET_TABLEID tableid,
JET_INDEX_COLUMN[] filters,
CursorFilterGrbit grbit);
#endregion
}
}