MySQL: fix the check for the return value of mysql_set_character_set()

It returns zero on success and non-zero on failure.

Fixes: QTBUG-97054
Pick-to: 6.2 6.2.1
Change-Id: Iea05060bc2c046928536fffd16adf0177aadb082
Reviewed-by: Liang Qi <liang.qi@qt.io>
bb10
Thiago Macieira 2021-10-14 08:43:43 -07:00
parent aad24f6033
commit 11f5c07c1b
1 changed files with 2 additions and 2 deletions

View File

@ -1305,10 +1305,10 @@ bool QMYSQLDriver::open(const QString& db,
optionFlags);
// now ask the server to match the charset we selected
if (!cs || mysql_set_character_set(d->mysql, cs->csname)) {
if (!cs || mysql_set_character_set(d->mysql, cs->csname) != 0) {
bool ok = false;
for (const char *p : wanted_charsets) {
if (mysql_set_character_set(d->mysql, p)) {
if (mysql_set_character_set(d->mysql, p) == 0) {
ok = true;
break;
}