SQLite sqlite3pp C++ api: how to load all sqlite3pp::transactions that can be found in db into some vector or set?
So I found out that sqlite3pp C++ SQLite db engine API has some concept of rollbackable transactions. I wonder if thows transactions can be extracted from db file for ex开发者_运维百科ample after application restart? And if so how to load all of tham in order thay have happened into some vector? (This would make creation of db items version and revision control easy)
According to the SQLite 3 docs:
If sqlite3_close() is invoked while a transaction is open, the transaction is automatically rolled back.
This is true whether you're using the API directly or indirectly with sqlite3pp. So you cannot preserve DB transactions across application restarts (since database connections are application-specific).
I have no idea what would happen if you simply exited the application without closing the database, but I'm pretty sure the transaction would be lost.
精彩评论