QGIS API Documentation 3.41.0-Master (af5edcb665c)
Loading...
Searching...
No Matches
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.
 
void queryStartedPrivate (const QgsDatabaseQueryLogEntry &query)
 Internal slot for logging queries as start.
 

Signals

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

Public Member Functions

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

Static Public Member Functions

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

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 124 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 42 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 154 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 56 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 48 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 74 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 68 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 147 of file qgsdbquerylog.h.


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