rdbms: improve query logging logic in Database
authorAaron Schulz <aschulz@wikimedia.org>
Tue, 7 May 2019 00:01:03 +0000 (17:01 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Wed, 8 May 2019 21:58:10 +0000 (14:58 -0700)
commite0cc49ce3971e19ef7b18c3e89897979564d3a01
treec2e1b1fdd99d841e9f3605d18c6df590faf8e3ce
parent25ee9366b06a44087e8f0cba1f2b27324259ef52
rdbms: improve query logging logic in Database

* Merge the two debug() calls in attemptQuery() into one single
  call which checks DBO_DEBUG. This avoids pointless SPI logger
  overhead.
* Avoid calling generalizeSQL() unless actually necessary. This
  works via a lazy-loading object.
* Make lastQuery() a bit more consistent in terms of when it
  gets updated.
* Add DBQueryDisconnectedError class for dropped connections.
* Clean up visbility and names of last query/error fields.

Change-Id: Ie8df3434d23b18f7a0f4c056d71388192cc52c6b
autoload.php
includes/db/MWLBFactory.php
includes/libs/rdbms/TransactionProfiler.php
includes/libs/rdbms/database/Database.php
includes/libs/rdbms/database/IDatabase.php
includes/libs/rdbms/database/utils/GeneralizedSql.php [new file with mode: 0644]
includes/libs/rdbms/exception/DBQueryDisconnectedError.php [new file with mode: 0644]