wpdb: When flushing results on a mysqli connection, make sure that `wpdb::$dbh` is a valid mysqli connection handle.

Fixes a unit test failure introduced in [30297].

Fixes #28155.

Props soulseekah.


Built from https://develop.svn.wordpress.org/trunk@30299


git-svn-id: http://core.svn.wordpress.org/trunk@30298 1a063a9b-81f0-0310-95a4-ce76da25c4cd