rdbms: allow construction of Database objects without connecting
authorAaron Schulz <aschulz@wikimedia.org>
Wed, 28 Feb 2018 20:56:34 +0000 (12:56 -0800)
committerAaron Schulz <aschulz@wikimedia.org>
Fri, 9 Mar 2018 03:47:35 +0000 (19:47 -0800)
commit434d5a6321329ec53110faf441fb825c609347ac
treeb145d3a33462765600eaa2194f841d9b7aec548d
parent2c9d6b95e27f5d511c59feceeba1368bac857d54
rdbms: allow construction of Database objects without connecting

* Database::factory() supports a $connect parameter, that defaults
  to NEW_CONNECTED (current behavior) but can also be NEW_UNCONNECTED.
* Add tests asserting the type of various instances returned from
  Database::factory().
* Clean up sqlite "conn" field handling to handle cases of it
  not being set, just as other classes do.
* Add some comments about the return type of doQuery().

Change-Id: Ic0837cfdb35326c2045133d664abd29043d48c03
includes/libs/rdbms/database/Database.php
includes/libs/rdbms/database/DatabaseMysqli.php
includes/libs/rdbms/database/DatabaseSqlite.php
tests/phpunit/includes/libs/rdbms/database/DatabaseTest.php