Commit d59bae7
docs: add FOR UPDATE clause to MySQL transaction example
Fixes issue where transaction example doesn't properly lock rows
in MySQL, which could lead to race conditions when reading and
then updating the same data.
The SELECT statement in the transaction example now includes
FOR UPDATE clause to provide exclusive row locking in MySQL/InnoDB,
as recommended in the MySQL documentation for safe read-then-update
operations within transactions.
Also adds explanation about locking reads in transactions to help
users understand when and why to use SELECT ... FOR UPDATE.
Fixes #3485
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>1 parent 6bc3e48 commit d59bae7
1 file changed
+6
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
4 | 8 | | |
5 | 9 | | |
6 | 10 | | |
| |||
15 | 19 | | |
16 | 20 | | |
17 | 21 | | |
18 | | - | |
| 22 | + | |
| 23 | + | |
19 | 24 | | |
20 | 25 | | |
21 | 26 | | |
| |||
0 commit comments