QGIS API Documentation 3.30.0-'s-Hertogenbosch (f186b8efe0)
Public Slots | Signals | Public Member Functions | Static Public Member Functions | List of all members
QgsDatabaseQueryLog Class Reference

Handles logging of database queries. More...

#include <qgsdbquerylog.h>

Inheritance diagram for QgsDatabaseQueryLog:
Inheritance graph
[legend]

Public Slots

void queryFinishedPrivate (const QgsDatabaseQueryLogEntry &query)
 Internal slot for logging queries as finished. More...
 
void queryStartedPrivate (const QgsDatabaseQueryLogEntry &query)
 Internal slot for logging queries as start. More...
 

Signals

void queryFinished (const QgsDatabaseQueryLogEntry &query)
 Emitted whenever a database query has finished executing. More...
 
void queryStarted (const QgsDatabaseQueryLogEntry &query)
 Emitted whenever a database query is started. More...
 

Public Member Functions

 QgsDatabaseQueryLog (QObject *parent=nullptr)
 Creates a new query log. More...
 

Static Public Member Functions

static bool enabled ()
 Returns true if logging is enabled. More...
 
static void finished (const QgsDatabaseQueryLogEntry &query)
 Records that the database query has finished. More...
 
static void log (const QgsDatabaseQueryLogEntry &query)
 Logs a database query as starting. More...
 
static void setEnabled (bool enabled)
 Enables query logging. More...
 

Detailed Description

Handles logging of database queries.

QgsDatabaseQueryLog is not usually directly created, but rather accessed through QgsApplication::databaseQueryLog(). Generally, clients should only access the static log() method to register their queries.

Example

# Log a database query
QgsDatabaseQueryLog.log('SELECT * FROM my_table')
static void log(const QgsDatabaseQueryLogEntry &query)
Logs a database query as starting.
Since
QGIS 3.24

Definition at line 131 of file qgsdbquerylog.h.

Constructor & Destructor Documentation

◆ QgsDatabaseQueryLog()

QgsDatabaseQueryLog::QgsDatabaseQueryLog ( QObject *  parent = nullptr)

Creates a new query log.

QgsDatabaseQueryLog is not usually directly created, but rather accessed through QgsApplication::databaseQueryLog().

Definition at line 41 of file qgsdbquerylog.cpp.

Member Function Documentation

◆ enabled()

static bool QgsDatabaseQueryLog::enabled ( )
inlinestatic

Returns true if logging is enabled.

See also
setEnabled()

Definition at line 161 of file qgsdbquerylog.h.

◆ finished()

void QgsDatabaseQueryLog::finished ( const QgsDatabaseQueryLogEntry query)
static

Records that the database query has finished.

This method can be safely called from any thread.

Definition at line 55 of file qgsdbquerylog.cpp.

◆ log()

void QgsDatabaseQueryLog::log ( const QgsDatabaseQueryLogEntry query)
static

Logs a database query as starting.

This method can be safely called from any thread.

Definition at line 47 of file qgsdbquerylog.cpp.

◆ queryFinished

void QgsDatabaseQueryLog::queryFinished ( const QgsDatabaseQueryLogEntry query)
signal

Emitted whenever a database query has finished executing.

Note
Not available in Python bindings

◆ queryFinishedPrivate

void QgsDatabaseQueryLog::queryFinishedPrivate ( const QgsDatabaseQueryLogEntry query)
slot

Internal slot for logging queries as finished.

Note
Not available in Python bindings.

Definition at line 73 of file qgsdbquerylog.cpp.

◆ queryStarted

void QgsDatabaseQueryLog::queryStarted ( const QgsDatabaseQueryLogEntry query)
signal

Emitted whenever a database query is started.

Note
Not available in Python bindings

◆ queryStartedPrivate

void QgsDatabaseQueryLog::queryStartedPrivate ( const QgsDatabaseQueryLogEntry query)
slot

Internal slot for logging queries as start.

Note
Not available in Python bindings.

Definition at line 67 of file qgsdbquerylog.cpp.

◆ setEnabled()

static void QgsDatabaseQueryLog::setEnabled ( bool  enabled)
inlinestatic

Enables query logging.

If disabled, no signals will be emitted by the log. By default the log is disabled, and clients must manually enable it.

Note
Not available in Python bindings
See also
enabled()

Definition at line 154 of file qgsdbquerylog.h.


The documentation for this class was generated from the following files: