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
parent
aad24f6033
commit
11f5c07c1b
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue