Akonadi::Server::DbConfig

Search for usage in LXR

#include <dbconfig.h>

Inherited by Akonadi::Server::DbConfigMysql, Akonadi::Server::DbConfigPostgresql, and Akonadi::Server::DbConfigSqlite.

Public Member Functions

virtual void apply (QSqlDatabase &database)=0
 
virtual QString databaseName () const =0
 
virtual QString driverName () const =0
 
virtual bool init (QSettings &settings, bool storeSettings=true)=0
 
virtual void initSession (const QSqlDatabase &database)
 
virtual bool isAvailable (QSettings &settings)=0
 
virtual void setup ()
 
virtual qint64 sizeThreshold () const
 
virtual bool startInternalServer ()
 
virtual void stopInternalServer ()
 
virtual bool useInternalServer () const =0
 

Static Public Member Functions

static DbConfigconfiguredDatabase ()
 
static bool isConfigured ()
 

Protected Member Functions

int execute (const QString &cmd, const QStringList &args) const
 

Static Protected Member Functions

static QString defaultAvailableDatabaseBackend (QSettings &settings)
 
static QString defaultDatabaseName ()
 

Detailed Description

A base class that provides an unique access layer to configuration and initialization of different database backends.

Definition at line 20 of file dbconfig.h.

Member Function Documentation

◆ apply()

virtual void Akonadi::Server::DbConfig::apply ( QSqlDatabase database)
pure virtual

This method applies the configured settings to the QtSql database instance.

◆ configuredDatabase()

DbConfig * DbConfig::configuredDatabase ( )
static

Returns the DbConfig instance for the database the user has configured.

Definition at line 73 of file dbconfig.cpp.

◆ databaseName()

virtual QString Akonadi::Server::DbConfig::databaseName ( ) const
pure virtual

Returns the database name.

◆ defaultDatabaseName()

QString DbConfig::defaultDatabaseName ( )
staticprotected

Returns the suggested default database name, if none is specified in the configuration already.

This includes instance namespaces, so usually this is not necessary to use in combination with internal databases (in process or using our own server instance).

Definition at line 133 of file dbconfig.cpp.

◆ driverName()

virtual QString Akonadi::Server::DbConfig::driverName ( ) const
pure virtual

Returns the name of the used driver.

◆ execute()

int DbConfig::execute ( const QString cmd,
const QStringList args 
) const
protected

Calls QProcess::execute() and also prints the command and arguments via qCDebug()

Definition at line 147 of file dbconfig.cpp.

◆ init()

virtual bool Akonadi::Server::DbConfig::init ( QSettings settings,
bool  storeSettings = true 
)
pure virtual

This method is called whenever the Akonadi server is started and before the initial database connection is set up.

At this point the default settings should be determined, merged with the given settings and written back if storeSettings is true.

◆ initSession()

void DbConfig::initSession ( const QSqlDatabase database)
virtual

Do session setup/initialization work on database.

An example would be to run some SQL commands on every new session, typically stuff like setting encodings, transaction isolation levels, etc.

Definition at line 142 of file dbconfig.cpp.

◆ isAvailable()

virtual bool Akonadi::Server::DbConfig::isAvailable ( QSettings settings)
pure virtual

This method checks if the requirements for this database connection are met in the system (i.e.

QMYSQL driver is available, mysqld binary is found, etc.).

◆ isConfigured()

bool DbConfig::isConfigured ( )
static

Returns whether database have been configured.

Definition at line 49 of file dbconfig.cpp.

◆ setup()

void DbConfig::setup ( )
virtual

This method is called to setup initial database settings after a connection is established.

Definition at line 123 of file dbconfig.cpp.

◆ sizeThreshold()

qint64 DbConfig::sizeThreshold ( ) const
virtual

Payload data bigger than this value will be stored in separate files, instead of the database.

Valid

Returns
the size threshold in bytes, defaults to 4096.

Definition at line 128 of file dbconfig.cpp.

◆ startInternalServer()

bool DbConfig::startInternalServer ( )
virtual

This method is called to start an external server.

Definition at line 112 of file dbconfig.cpp.

◆ stopInternalServer()

void DbConfig::stopInternalServer ( )
virtual

This method is called to stop the external server.

Definition at line 118 of file dbconfig.cpp.

◆ useInternalServer()

virtual bool Akonadi::Server::DbConfig::useInternalServer ( ) const
pure virtual

Returns whether an internal server needs to be used.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Tue Aug 16 2022 04:00:10 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.