Important: |
---|
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
This function creates a session to begin, commit, or roll back transactions.
Syntax
HANDLE CeCreateSession( CEGUID* pGuid ); |
Parameters
- pGuid
-
[in] CEGUID of the mounted volume for which to create the session. Mount a volume by using the CeMountDBVolEx (EDB)function.
Return Value
INVALID_HANDLE_VALUE indicates failure. To get extended error information, call GetLastError. The following table lists possible values.
Return Value | Description |
---|---|
ERROR_INVALID_PARAMETER |
The pGuidparameter is set to NULL. |
ERROR_NOT_FOUND |
The volume is not mounted, or pGuidis not a valid GUID. |
Remarks
Transactions group a set of changes into a single atomic commit operation so that either all changes occur, or none do. Transactions guard against partially modified databases in a system crash or power failure.
If you pass NULL for the session handle when opening a database, EDB internally creates a new session for that opened database, and each operation performed on the database is atomic. Obtain the session handle for an opened database by calling the CeGetDatabaseSession (EDB)function.
Even if you pass a session handle when you open a database, you have not started a transaction. You must first call the CeBeginTransaction (EDB)function for a session. Then all changes made to all databases opened with that session are logged until you call the CeEndTransaction (EDB)function. CeEndTransactionenables you to either commit or roll back all changes made in the session since the matching CeBeginTransactioncall was made.
Once you have opened a database, you cannot change its session.
A single transaction cannot span multiple volumes. However, you can perform a transaction that spans multiple databases in one volume by passing the same session handle in the call to the CeOpenDatabaseInSession (EDB)function.
The handle returned from this function must be closed by calling the CloseHandlefunction. If a session is closed and it is still in a transaction, all of the uncommitted changes are rolled back.
Requirements
Header | windbase.h |
Library | coredll.lib |
Windows Embedded CE | Windows CE 5.0 and later |
Windows Mobile | Windows Mobile Version 5.0 and later |