SQL: replace qPrintable() / toLocal8Bit() with unicode versions

Replace qPrintable() and toLocal8Bit() with qUtf16Printable()

Change-Id: Id30b5ba611b005faab91a08b10a9dc5569fd7a07
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
Christian Ehrlicher 2023-04-17 20:41:55 +02:00
parent fd879a38cc
commit db7dc35897
3 changed files with 19 additions and 17 deletions

View File

@ -941,7 +941,7 @@ QIBaseResult::QIBaseResult(const QIBaseDriver *db)
bool QIBaseResult::prepare(const QString& query)
{
Q_D(QIBaseResult);
// qDebug("prepare: %s", qPrintable(query));
// qDebug("prepare: %ls", qUtf16Printable(query));
if (!driver() || !driver()->isOpen() || driver()->isOpenError())
return false;
d->cleanup();
@ -1835,8 +1835,8 @@ bool QIBaseDriver::subscribeToNotification(const QString &name)
}
if (d->eventBuffers.contains(name)) {
qWarning("QIBaseDriver::subscribeToNotificationImplementation: already subscribing to '%s'.",
qPrintable(name));
qWarning("QIBaseDriver::subscribeToNotificationImplementation: already subscribing to '%ls'.",
qUtf16Printable(name));
return false;
}
@ -1882,8 +1882,8 @@ bool QIBaseDriver::unsubscribeFromNotification(const QString &name)
}
if (!d->eventBuffers.contains(name)) {
qWarning("QIBaseDriver::QIBaseSubscriptionState not subscribed to '%s'.",
qPrintable(name));
qWarning("QIBaseDriver::QIBaseSubscriptionState not subscribed to '%ls'.",
qUtf16Printable(name));
return false;
}
@ -1938,8 +1938,8 @@ void QIBaseDriver::qHandleEventNotification(void *updatedResultBuffer)
(&qEventCallback)),
eBuffer->resultBuffer);
if (Q_UNLIKELY(status[0] == 1 && status[1])) {
qCritical("QIBaseDriver::qHandleEventNotification: could not resubscribe to '%s'",
qPrintable(i.key()));
qCritical("QIBaseDriver::qHandleEventNotification: could not resubscribe to '%ls'",
qUtf16Printable(i.key()));
}
return;

View File

@ -380,8 +380,10 @@ void QPSQLResultPrivate::deallocatePreparedStmt()
const QString stmt = QStringLiteral("DEALLOCATE ") + preparedStmtId;
PGresult *result = drv_d_func()->exec(stmt);
if (PQresultStatus(result) != PGRES_COMMAND_OK)
qWarning("Unable to free statement: %s", PQerrorMessage(drv_d_func()->connection));
if (PQresultStatus(result) != PGRES_COMMAND_OK) {
const QString msg = QString::fromUtf8(PQerrorMessage(drv_d_func()->connection));
qWarning("Unable to free statement: %ls", qUtf16Printable(msg));
}
PQclear(result);
}
preparedStmtId.clear();
@ -913,7 +915,7 @@ void QPSQLDriverPrivate::setDatestyle()
PGresult *result = exec("SET DATESTYLE TO 'ISO'");
int status = PQresultStatus(result);
if (status != PGRES_COMMAND_OK)
qWarning("%s", PQerrorMessage(connection));
qWarning() << QString::fromUtf8(PQerrorMessage(connection));
PQclear(result);
}
@ -926,7 +928,7 @@ void QPSQLDriverPrivate::setByteaOutput()
PGresult *result = exec("SET bytea_output TO escape");
int status = PQresultStatus(result);
if (status != PGRES_COMMAND_OK)
qWarning("%s", PQerrorMessage(connection));
qWarning() << QString::fromUtf8(PQerrorMessage(connection));
PQclear(result);
}
}
@ -1583,8 +1585,8 @@ bool QPSQLDriver::unsubscribeFromNotification(const QString &name)
}
if (!d->seid.contains(name)) {
qWarning("QPSQLDriver::unsubscribeFromNotificationImplementation: not subscribed to '%s'.",
qPrintable(name));
qWarning("QPSQLDriver::unsubscribeFromNotificationImplementation: not subscribed to '%ls'.",
qUtf16Printable(name));
return false;
}
@ -1633,8 +1635,8 @@ void QPSQLDriver::_q_handleNotification()
emit notification(name, source, payload);
}
else
qWarning("QPSQLDriver: received notification for '%s' which isn't subscribed to.",
qPrintable(name));
qWarning("QPSQLDriver: received notification for '%ls' which isn't subscribed to.",
qUtf16Printable(name));
qPQfreemem(notify);
}

View File

@ -984,7 +984,7 @@ bool QSQLiteDriver::subscribeToNotification(const QString &name)
}
if (d->notificationid.contains(name)) {
qWarning("Already subscribing to '%s'.", qPrintable(name));
qWarning("Already subscribing to '%ls'.", qUtf16Printable(name));
return false;
}
@ -1005,7 +1005,7 @@ bool QSQLiteDriver::unsubscribeFromNotification(const QString &name)
}
if (!d->notificationid.contains(name)) {
qWarning("Not subscribed to '%s'.", qPrintable(name));
qWarning("Not subscribed to '%ls'.", qUtf16Printable(name));
return false;
}