A session makes it possible to create a command and a rowset, and to create or modify tables and indexes. It is a basic part of the OLE DB connection model. The primary function is to define a transaction: that mechanism used to identify persistent units of work within an application.
Sessions:
CoType TSession {
[mandatory] interface IGetDataSource;
[mandatory] interface IOpenRowset;
[mandatory] interface ISessionProperties;
[optional] interface IDBCreateCommand;
[optional] interface IDBSchemaRowset;
[optional] interface IIndexDefinition;
[optional] interface ISupportErrorInfo;
[optional] interface ITableDefinition;
[optional] interface ITransaction;
[optional] interface ITransactionJoin;
[optional] interface ITransactionLocal;
[optional] interface ITransactionObject;
}
If the session supports ITransactionLocal, the consumer can call ITransactionLocal::StartTransaction to start an explicit transaction. The session is then said to be in manual commit mode and any work done in the session must be explicitly committed or aborted. If ITransactionLocal is not supported or if the consumer does not call StartTransaction, the session is said to be in autocommit mode and any work done in the session is automatically committed; it cannot be aborted. For more information about transactions, see Chapter 12, "Transactions."
To create a session, a consumer calls IDBCreateSession::CreateSession in the data source object. A single data source object can support multiple sessions and, therefore, multiple transactions. From a session, the consumer can do the following: