rdbms: normalize Database open() code and error handling
authorAaron Schulz <aschulz@wikimedia.org>
Thu, 11 Jul 2019 02:35:46 +0000 (19:35 -0700)
committerTimo Tijhof <krinklemail@gmail.com>
Fri, 26 Jul 2019 14:24:28 +0000 (15:24 +0100)
commit023c73f6128ab2c761f37358f125b6108fd102f5
tree298c6f856b28a94393085fae199aab1750c2492d
parent22f137ced85fe4841c71ba6c2b9faf6199b5a539
rdbms: normalize Database open() code and error handling

Mainly:
* Use oci_new_connect() for Oracle to avoid broken connection reuse
  similar to the PGSQL_CONNECT_FORCE_NEW flag in DatabasePostgres
* Set 'client_min_messages' unconditionally for PostgreSQL
* Factor out Database::getConnectExceptionAndLog() helper method
* Use the same style of query() calls in DatabaseOracle::open() as
  the other subclasses
* Make sure the Database driver handle field is null on failure
  instead of false for sanity

Also:
* Disallow changing of Database handle DBO_* flags after construction
  where it does not make sense to change them
* Do not mention DBO_* flags meant for non-config use in $wgDBservers
* Ignore DBO_PERSISTENT for SQLite if DBO_TRX is also set for sanity
* Remove $wgDBOracleDRCP variable to discourage careless automatic
  setting of DBO_PERSISTENT that breaks LoadBalancer assumptions

Change-Id: Iea948f7f872294ea8fc5d897fc10c9d29b7141d5
12 files changed:
RELEASE-NOTES-1.34
includes/DefaultSettings.php
includes/db/DatabaseOracle.php
includes/db/MWLBFactory.php
includes/libs/rdbms/database/Database.php
includes/libs/rdbms/database/DatabaseMssql.php
includes/libs/rdbms/database/DatabaseMysqlBase.php
includes/libs/rdbms/database/DatabaseMysqli.php
includes/libs/rdbms/database/DatabasePostgres.php
includes/libs/rdbms/database/DatabaseSqlite.php
includes/libs/rdbms/database/IDatabase.php
tests/phpunit/includes/libs/rdbms/database/DatabaseTest.php