hmm, I thought the chained mode will handle that already for me. If I'm in chained mode I have execute a rollback (in case of error) and everything since the last commit will be undone. Or in case of success I execute a commit and everything will be written to the database. That's already atomic...