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 ends a transaction.
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 hSessionparameter 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
FlushIntervalparameter 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 |
Windows Mobile | Windows Mobile Version 5.0 and later |