As it is possible to use the C language API to implement functions within a C++ application, it may be necessary to use a transaction handle for a transaction started by McoSqlEngine. For this purpose the class McoTransaction is provided:
class McoTransaction: public McoSql::Transaction { ... public: mco_trans_h handle(); };To obtain a transaction handle for use with the C API, the C function must simply cast a pointer to a C++
Transaction
object to a McoTransaction and then call its handle method; then use this handle as usual in the C API runtime function calls. For example, given a C++ Transaction objectcppTransaction
, we could obtain a C API transaction handle as follows:McoTransaction trans = (McoTransaction)*cppTransaction; mco_trans_h t = trans.handle();