rdbms: make DOMAIN_ANY ignore bogus MySQL DB names in config
This regressed in
14ee3f2, trying to select the server config
"dbname" value as the database on connect. If that config is
bogus, then the connection attempt would fail. Instead, always
pass null to the driver's connection function if the DB domain
doesn't matter.
This affected WMF sites during lag checks, on account of the
"serverTemplate" value in $wgLBFactoryConf always using the local
wiki domain (whether the cluster had such a database or not).
Use strlen() as mysqli sees null and "" as the same for $dbname.
Bug: T186764
Change-Id: I6699d17c0125a08415046211fee7906bbaf2c366