| 1 |
SET autocommit = 0; |
| 2 |
START TRANSACTION; |
| 3 |
INSERT INTO t1 (`id`, `int1`, `int1_key`, `int1_unique`, |
| 4 |
`int2`, `int2_key`, `int2_unique`, |
| 5 |
`for_update`, `is_uncommitted`, `is_consistent`) |
| 6 |
SELECT src.`id`, src.`int1`, src.`int1_key`, src.`int1_unique`, |
| 7 |
src.`int2`, src.`int2_key`, src.`int2_unique`, |
| 8 |
src.`for_update`, src.`is_uncommitted`, src.`is_consistent` |
| 9 |
FROM t1 AS src |
| 10 |
WHERE (src.`pk` BETWEEN 1000 AND 1049) AND (src.`id` > 0) AND (src.`is_consistent` = 1) AND (src.`int1_unique` MOD 8 = 0) |
| 11 |
ON DUPLICATE KEY UPDATE `int1_unique`= src.`int1_unique` + CONNECTION_ID() + 1000, `int2_unique`= src.`int2_unique` - (CONNECTION_ID()+1000); |
| 12 |
*** Updating id and connection_id if we actually inserted something (query log disabled)... |
| 13 |
COMMIT; |