16#ifndef QGSDBQUERYLOG_H
17#define QGSDBQUERYLOG_H
61 quint64 startedTime = 0;
66 quint64 finishedTime = 0;
86 long long fetchedRows = -1;
96 bool canceled =
false;
100 static QAtomicInt sQueryId;
204 static bool sEnabled;
214class QgsDatabaseQueryLogWrapper
219 QgsDatabaseQueryLogWrapper(
const QString &query,
const QString &uri,
const QString &provider,
const QString &initiatorClass,
const QString &origin )
223 mEntry.origin = origin;
224 mEntry.initiatorClass = initiatorClass;
225 mEntry.provider = provider;
229 ~QgsDatabaseQueryLogWrapper( )
234 void setFetchedRows(
long long fetchedRows )
236 mEntry.fetchedRows = fetchedRows;
239 void setQuery(
const QString &query )
241 mEntry.query = query;
244 void setError(
const QString &error )
246 mEntry.error = error;
251 mEntry.canceled =
true;
Encapsulates a logged database query.
QString query
The logged database query (e.g. the SQL query)
QString provider
Provider key.
QString initiatorClass
The QGIS class which initiated the query.
QString origin
Code file location for the query origin.
QString error
Error reported by the provider, normally blank.
Handles logging of database queries.
static void log(const QgsDatabaseQueryLogEntry &query)
Logs a database query as starting.
static bool enabled()
Returns true if logging is enabled.
static void setEnabled(bool enabled)
Enables query logging.
void queryFinished(const QgsDatabaseQueryLogEntry &query)
Emitted whenever a database query has finished executing.
static void finished(const QgsDatabaseQueryLogEntry &query)
Records that the database query has finished.
void queryStarted(const QgsDatabaseQueryLogEntry &query)
Emitted whenever a database query is started.
Q_DECLARE_METATYPE(QgsDatabaseQueryLogEntry)