Fix SQLite exception when $wgDBuser is set
Fixed from several different directions:
* The error reporting was screwed up, so I wrapped the PDOException
in a DBUnexpectedError.
* Make $db->open() trigger a close/open sequence if called a second
time, like MySQL, instead of breaking mTrxLevel.
* Don't call $this->open() twice from the constructor, even if $user is
set.
The bug dates to r84485. The nasty hack allowing you to construct a
do-nothing database object with "new Database()" dates back to 2004 and
has probably outlived its usefulness -- noted this. It was formerly used
by LoadBalancer::reportConnectionError().
Bug: 49254
Change-Id: I571f9209bec8e8ed5058b6327e1738eb4315d5a0