SQL/SQLite: use categorized logger
Use the categorized logger qt.sql.sqlite Change-Id: I70880fca579df56500ddc94a72bc6c616c475e67 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>bb10
parent
d99d355e49
commit
1dd3f46570
|
|
@ -7,6 +7,7 @@
|
|||
#include <qdatetime.h>
|
||||
#include <qdebug.h>
|
||||
#include <qlist.h>
|
||||
#include <qloggingcategory.h>
|
||||
#include <qsqlerror.h>
|
||||
#include <qsqlfield.h>
|
||||
#include <qsqlindex.h>
|
||||
|
|
@ -38,6 +39,8 @@ Q_DECLARE_METATYPE(sqlite3_stmt*)
|
|||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
static Q_LOGGING_CATEGORY(lcSqlite, "qt.sql.sqlite")
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
static int qGetColumnType(const QString &tpName)
|
||||
|
|
@ -803,7 +806,7 @@ bool QSQLiteDriver::open(const QString & db, const QString &, const QString &, c
|
|||
}
|
||||
#endif
|
||||
else
|
||||
qWarning("Unsupported option '%ls'", qUtf16Printable(option.toString()));
|
||||
qCWarning(lcSqlite, "Unsupported option '%ls'", qUtf16Printable(option.toString()));
|
||||
}
|
||||
|
||||
int openMode = (openReadOnlyOption ? SQLITE_OPEN_READONLY : (SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE));
|
||||
|
|
@ -814,7 +817,7 @@ bool QSQLiteDriver::open(const QString & db, const QString &, const QString &, c
|
|||
#if defined(SQLITE_OPEN_NOFOLLOW)
|
||||
openMode |= SQLITE_OPEN_NOFOLLOW;
|
||||
#else
|
||||
qWarning("SQLITE_OPEN_NOFOLLOW not supported with the SQLite version %s", sqlite3_libversion());
|
||||
qCWarning(lcSqlite, "SQLITE_OPEN_NOFOLLOW not supported with the SQLite version %s", sqlite3_libversion());
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -1055,12 +1058,13 @@ bool QSQLiteDriver::subscribeToNotification(const QString &name)
|
|||
{
|
||||
Q_D(QSQLiteDriver);
|
||||
if (!isOpen()) {
|
||||
qWarning("Database not open.");
|
||||
qCWarning(lcSqlite, "QSQLiteDriver::subscribeToNotification: Database not open.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (d->notificationid.contains(name)) {
|
||||
qWarning("Already subscribing to '%ls'.", qUtf16Printable(name));
|
||||
qCWarning(lcSqlite, "QSQLiteDriver::subscribeToNotification: Already subscribing to '%ls'.",
|
||||
qUtf16Printable(name));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -1076,12 +1080,13 @@ bool QSQLiteDriver::unsubscribeFromNotification(const QString &name)
|
|||
{
|
||||
Q_D(QSQLiteDriver);
|
||||
if (!isOpen()) {
|
||||
qWarning("Database not open.");
|
||||
qCWarning(lcSqlite, "QSQLiteDriver::unsubscribeFromNotification: Database not open.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!d->notificationid.contains(name)) {
|
||||
qWarning("Not subscribed to '%ls'.", qUtf16Printable(name));
|
||||
qCWarning(lcSqlite, "QSQLiteDriver::unsubscribeFromNotification: Not subscribed to '%ls'.",
|
||||
qUtf16Printable(name));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue