Akonadi::Server::DbConfig

Search for usage in LXR

#include <dbconfig.h>

Public Member Functions

virtual void apply (QSqlDatabase &database)=0
 
virtual QString databaseName () const =0
 
virtual QString databasePath () const =0
 
virtual bool disableConstraintChecks (const QSqlDatabase &db)=0
 
virtual QString driverName () const =0
 
virtual bool enableConstraintChecks (const QSqlDatabase &db)=0
 
virtual bool init (QSettings &settings, bool storeSettings=true, const QString &overrideDbPath={})=0
 
virtual void initSession (const QSqlDatabase &database)
 
virtual bool isAvailable (QSettings &settings)=0
 
virtual void setDatabasePath (const QString &path, 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 void destroy ()
 
static bool isConfigured ()
 

Protected Member Functions

 DbConfig (const QString &configFile)
 
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.

Constructor & Destructor Documentation

◆ ~DbConfig()

DbConfig::~DbConfig ( )
virtual

Definition at line 49 of file dbconfig.cpp.

◆ DbConfig() [1/2]

DbConfig::DbConfig ( )
explicitprotected

Definition at line 28 of file dbconfig.cpp.

◆ DbConfig() [2/2]

DbConfig::DbConfig ( const QString & configFile)
explicitprotected

Definition at line 33 of file dbconfig.cpp.

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 77 of file dbconfig.cpp.

◆ databaseName()

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

Returns the database name.

◆ databasePath()

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

Returns path to the database file or directory.

◆ defaultAvailableDatabaseBackend()

QString DbConfig::defaultAvailableDatabaseBackend ( QSettings & settings)
staticprotected

Definition at line 58 of file dbconfig.cpp.

◆ 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 143 of file dbconfig.cpp.

◆ destroy()

void DbConfig::destroy ( )
static

Destroys the current global DbConfig instance.

The subsequent call to configuredDatabase() will create a new DbConfig from current configuration.

Definition at line 116 of file dbconfig.cpp.

◆ disableConstraintChecks()

virtual bool Akonadi::Server::DbConfig::disableConstraintChecks ( const QSqlDatabase & db)
pure virtual

Disables foreign key constraint checks.

◆ driverName()

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

Returns the name of the used driver.

◆ enableConstraintChecks()

virtual bool Akonadi::Server::DbConfig::enableConstraintChecks ( const QSqlDatabase & db)
pure virtual

Re-enables foreign key constraint checks.

◆ 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 157 of file dbconfig.cpp.

◆ init()

virtual bool Akonadi::Server::DbConfig::init ( QSettings & settings,
bool storeSettings = true,
const QString & overrideDbPath = {} )
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.

When overrideDbPath is specified, the database will be stored inside this directory instead of the default location.

◆ 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 152 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 53 of file dbconfig.cpp.

◆ setDatabasePath()

virtual void Akonadi::Server::DbConfig::setDatabasePath ( const QString & path,
QSettings & settings )
pure virtual

Set the path to the database file or directory.

◆ setup()

void DbConfig::setup ( )
virtual

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

Definition at line 133 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 138 of file dbconfig.cpp.

◆ startInternalServer()

bool DbConfig::startInternalServer ( )
virtual

This method is called to start an external server.

Definition at line 122 of file dbconfig.cpp.

◆ stopInternalServer()

void DbConfig::stopInternalServer ( )
virtual

This method is called to stop the external server.

Definition at line 128 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-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:08:30 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.