This is just like... SQL 101 for transactions and locking. These are basic, elementary concepts in databases.
There's nothing "incorrect by construction".
The author claims the original snippet "looks completely reasonable". It absolutely does not, if you know anything about client-server databases.