I want to make sure that if any error occurs during the database processing phase, program will know it need to roll back the whole process.
any good ORM in MFC/C++ for doing this ?
I want to make sure that if any error occurs during the database processing phase, program will know it need to roll back the whole process.
any good ORM in MFC/C++ for doing this ?
If you're connecting to a transactional database, like SQL Server, Oracle, PostgreSQL, Firebird, some of MySQL's data engines, etc. then they will have an API for transactions. Similarly, some non-SQL databases also have transactional semantics and an associated API (like Berkeley DB). Since you don't mention what database you're using, I really don't know what else to say.
This has nothing to do with ORM. You want basic transaction functionality
If you're using MFC, then most likely you're working with your database either via CDatabase
(ODBC), CDaoWorkspace
/CDaoDatabase
(DAO), or CDataConnection
/CSession
(OLE DB). If so, you should use CDatabase::Rollback
, CDaoWorkspace::Rollback
, or CSession::Abort
, respectively.
The MFC _ConnectionPtr object has BeginTrans, CommitTrans and RollbackTrans methods.
http://msdn.microsoft.com/en-us/library/ms675942(VS.85).aspx
I wouldn't call it good though, you'd need to wrap it.