user avatar
Fix QMYSQL plugin database connection setup check
Samuel Gaist authored
Opening a connection to an e.g. inactive server will return true
regardless of the server accessibility.
This patch aims to fix the current checks done.

The first one is an allocation check which should only fail if there's
not enough memory but is currently wrote as if the connection failed
there.

The second check that is "failing" is the connection setup. The return
value should either be NULL or the same value provided as first
parameter. That is now verified.

[ChangeLog][QtSql][QSqlDatabase] Fixed a bug where opening a
connection to a MySQL database using the QMYSQL plugin would always
return true even if the server was unreachable. This bug could
also lead to crashes depending on the platform used.

Task-number: QTBUG-47784
Task-number: QTBUG-47452
Change-Id: I91651684b5a342eaa7305473e26d8371b35396c4
Reviewed-by: default avatarAndy Shaw <andy.shaw@theqtcompany.com>
0de6c52b