Share via


Remember - JetRollback can close cursors

This is an ESENT programming error I've made a few times, watch out for this pattern:

JET_TABLEID tableid = JET_tableidNil;JetBeginTransaction(sesid);JetOpenTable(sesid, dbid, "table", &tableid, ...); (do some stuff) if (success)    JetCommitTransaction(sesid, ...);else    JetRollback(sesid);JetCloseTable(sesid, tableid);

The problem is that the call to JetRollback closes the table before the JetCloseTable call. The easiest way to avoid this problem is to open the table inside of the transaction.