summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Ehrlicher <ch.ehrlicher@gmx.de>2023-04-17 20:41:55 +0200
committerChristian Ehrlicher <ch.ehrlicher@gmx.de>2023-04-18 00:11:05 +0200
commitdb7dc358978d93a246c020143ebcacf1fcf87217 (patch)
tree84c87237fe14dd706e654107617cf955d3bc9d7f
parentfd879a38cc31c47097f7847ea1352a2572890e8c (diff)
SQL: replace qPrintable() / toLocal8Bit() with unicode versions
Replace qPrintable() and toLocal8Bit() with qUtf16Printable() Change-Id: Id30b5ba611b005faab91a08b10a9dc5569fd7a07 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
-rw-r--r--src/plugins/sqldrivers/ibase/qsql_ibase.cpp14
-rw-r--r--src/plugins/sqldrivers/psql/qsql_psql.cpp18
-rw-r--r--src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp4
3 files changed, 19 insertions, 17 deletions
diff --git a/src/plugins/sqldrivers/ibase/qsql_ibase.cpp b/src/plugins/sqldrivers/ibase/qsql_ibase.cpp
index 859dc7ed6b..047b64d4d0 100644
--- a/src/plugins/sqldrivers/ibase/qsql_ibase.cpp
+++ b/src/plugins/sqldrivers/ibase/qsql_ibase.cpp
@@ -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;
diff --git a/src/plugins/sqldrivers/psql/qsql_psql.cpp b/src/plugins/sqldrivers/psql/qsql_psql.cpp
index ed222990ab..2b985ee2ee 100644
--- a/src/plugins/sqldrivers/psql/qsql_psql.cpp
+++ b/src/plugins/sqldrivers/psql/qsql_psql.cpp
@@ -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);
}
diff --git a/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp b/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp
index 2933c68a9d..60661e6824 100644
--- a/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp
+++ b/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp
@@ -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;
}