| description | Learn more about: CSession Class | |||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| title | CSession Class | |||||||||||||||||||||||||||||
| ms.date | 11/04/2016 | |||||||||||||||||||||||||||||
| f1_keywords |
|
|||||||||||||||||||||||||||||
| helpviewer_keywords |
|
|||||||||||||||||||||||||||||
| ms.assetid | 83cd798f-b45d-4f11-a23c-29183390450c |
Represents a single database access session.
class CSessionHeader: atldbcli.h
| Name | Description |
|---|---|
| Abort | Cancels (terminates) the transaction. |
| Close | Closes the session. |
| Commit | Commits the transaction. |
| GetTransactionInfo | Returns information regarding a transaction. |
| Open | Opens a new session for the data source object. |
| StartTransaction | Begins a new transaction for this session. |
One or more sessions can be associated with each provider connection (data source), which is represented by a CDataSource object. To create a new CSession for a CDataSource, call CSession::Open. To begin a database transaction, CSession provides the StartTransaction method. Once a transaction is started, you can commit to it using the Commit method, or cancel it using the Abort method.
Terminates the transaction.
HRESULT Abort(BOID* pboidReason = NULL,
BOOL bRetaining = FALSE,
BOOL bAsync = FALSE) const throw();See ITransaction::Abort in the OLE DB Programmer's Reference.
A standard HRESULT.
Closes the session, which was opened by CSession::Open.
void Close() throw();Releases the m_spOpenRowset pointer.
Commits the transaction.
HRESULT Commit(BOOL bRetaining = FALSE,
DWORD grfTC = XACTTC_SYNC,
DWORD grfRM = 0) const throw();See ITransaction::Commit in the OLE DB Programmer's Reference.
A standard HRESULT.
For more information, see ITransaction::Commit.
Returns information regarding a transaction.
HRESULT GetTransactionInfo(XACTTRANSINFO* pInfo) const throw();See ITransaction::GetTransactionInfo in the OLE DB Programmer's Reference.
A standard HRESULT.
For more information, see ITransaction::GetTransactionInfo in the OLE DB Programmer's Reference.
Opens a new session for the data source object.
HRESULT Open(const CDataSource& ds,
DBPROPSET *pPropSet = NULL,
ULONG ulPropSets = 0) throw();ds
[in] The data source for which the session is to be opened.
pPropSet
[in] A pointer to an array of DBPROPSET structures containing properties and values to be set. See Property Sets and Property Groups in the OLE DB Programmer's Reference in the Windows SDK.
ulPropSets
[in] The number of DBPROPSET structures passed in the pPropSet argument.
A standard HRESULT.
You must open the data source object using CDataSource::Open before passing it to CSession::Open.
Begins a new transaction for this session.
HRESULT StartTransaction(ISOLEVEL isoLevel = ISOLATIONLEVEL_READCOMMITTED,
ULONG isoFlags = 0,
ITransactionOptions* pOtherOptions = NULL,
ULONG* pulTransactionLevel = NULL) const throw();See ITransactionLocal::StartTransaction in the OLE DB Programmer's Reference.
A standard HRESULT.
For more information, see ITransactionLocal::StartTransaction in the OLE DB Programmer's Reference.
CatDB
OLE DB Consumer Templates
OLE DB Consumer Templates Reference