rdbms: make replace()/upsert() use atomic sections
authorAaron Schulz <aschulz@wikimedia.org>
Wed, 28 Feb 2018 22:41:18 +0000 (14:41 -0800)
committerKrinkle <krinklemail@gmail.com>
Fri, 2 Mar 2018 00:24:12 +0000 (00:24 +0000)
commit3193c0fb28256c9fa69f1bb24a3c01c87b9cab3c
treefba2cba34f9a261fdd2ccbfc8dabb8dfae041bb4
parent6695ce29a07434f1a08f794c94640e86f17b51da
rdbms: make replace()/upsert() use atomic sections

This makes them consistent with nonNativeInsertSelect()

Style aside, there is also the potential edge case of:
a) no transaction being active yet, with
b) the first query being replace() or upsert(), with
c) DBO_TRX being set (usually part of an implicit transaction round)

Previously, in that case, these methods would commit the transaction
they started, rather than leave it open. The correct semantics are
to leave it open. Since MySQL redefined upsert() to use ON DUPLICATE
KEY UPDATE, it already had the right behavior.

Also make sure that rollback() always sets the affectedRowCount
field to 0.

Change-Id: I15f923d3d4799cffc60e3aaea934f4ca1a9488e1
includes/libs/rdbms/database/Database.php