CeEndTransaction (EDB) (Windows Embedded CE 6.0)
1/6/2010
This function ends a transaction.
This function does not work with CEDB databases. For more information about CEDB, see CEDB Reference.
Syntax
BOOL CeEndTransaction(
HANDLE hSession,
BOOL fCommit
);
Parameters
- hSession
[in] Handle to the session. This handle must be returned from either the CeCreateSession (EDB) or the CeGetDatabaseSession (EDB) function.
- fCommit
[in] Specifies whether to commit the transaction. Specify TRUE to have all pending changes committed to the database. Specify FALSE to roll back all pending changes. If you specify TRUE, the committed changes are not flushed to disk until the flush interval has elapsed or until you call the CeFlushDBVol (EDB) function.
Return Value
TRUE indicates success. FALSE indicates failure. To get extended error information, call GetLastError. The following table lists possible values.
Return Value | Description |
---|---|
E_FAIL |
The database is corrupted. |
ERROR_INVALID_HANDLE |
The hSession parameter is set to NULL or equal to INVALID_HANDLE_VALUE. |
ERROR_NOT_FOUND |
The session is not in a transaction. |
Remarks
This function fails if the session is not in a transaction. You must first call the CeBeginTransaction (EDB) function. When a transaction is running, all changes made to all databases using the same session are not committed or rolled back until this function is called. This function enables you to either commit and save all changes, or roll back and throw away all changes.
If changes are committed, they are not written to file until a flush occurs. The committed changes are cached until one of the following occurs:
The volume is explicitly flushed. For more information about explicitly flushing a volume, see CeFlushDBVol (EDB).
The FlushInterval parameter setting for the volume is reached.
The volume is unmounted.
Note
Even if a transaction is committed, some locks may still be held in the database. To ensure that all locks are released, close the handle to the database.
Requirements
Header | windbase.h |
Library | coredll.lib |
Windows Embedded CE | Windows CE 5.0 and later |
See Also
Reference
EDB Functions
CeCreateSession (EDB)
CeGetDatabaseSession (EDB)
CeBeginTransaction (EDB)
CeFlushDBVol (EDB)