Share via


CeCreateSession (EDB)

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

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 pGuid parameter is set to NULL.

ERROR_NOT_FOUND

The volume is not mounted, or pGuid is 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. CeEndTransaction enables you to either commit or roll back all changes made in the session since the matching CeBeginTransaction call 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 CloseHandle function. 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

See Also

Reference

EDB Functions
CeMountDBVolEx (EDB)
CeGetDatabaseSession (EDB)
CeBeginTransaction (EDB)
CeEndTransaction (EDB)
CeOpenDatabaseInSession (EDB)
CloseHandle