On 2026-04-16 01:39, Georg Richter wrote:
If mysqli were to automatically inject START TRANSACTION and COMMIT, it
could unexpectedly commit a user's existing work or interfere with their
manual transaction logic.
>
Couldn't a SAVEPOINT command be injected instead, with a RELEASE
SAVEPOINT on success and ROLLBACK TO SAVEPOINT on error? Of course now
the driver has to be aware of any current transaction to know it's to
use savepoints instead of a whole transaction...
Furthermore, an 'automatic' transaction would
be a false promise on engines like MyISAM, where BEGIN and COMMIT are
simply ignored, still resulting in partial inserts.
At which point the recommendation to users to wrap bulk executions in
such commands is ineffective anyway. But if they're using a
nontransactional engine they should already be aware of these pitfalls.