digiKam Developer Documentation: Digikam::DbEngineParameters Class Reference

| digiKam Developer Documentation Professional Photo Management with the Power of Open Source

Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
Digikam::DbEngineParameters Class Reference

This class encapsulates all parameters needed to establish a connection to a database (inspired by the API of Qt::Sql). More...

## Public Member Functions
| DbEngineParameters (const QString &_type, const QString &_databaseNameCore, const QString &_connectOptions=QString(), const QString &_hostName=QString(), int _port=-1, bool _walMode=false, bool _internalServer=false, const QString &_userName=QString(), const QString &_password=QString(), const QString &_databaseNameThumbnails=QString(), const QString &_databaseNameFace=QString(), const QString &_databaseNameSimilarity=QString(), const QString &_internalServerDBPath=QString(), const QString &_internalServerMysqlInitCmd=QString(), const QString &_internalServerMysqlAdminCmd=QString(), const QString &_internalServerMysqlServerCmd=QString(), const QString &_internalServerMysqlUpgradeCmd=QString())
| DbEngineParameters (const QUrl &url)
| QUrl helpers.
DbEngineParameters | faceParameters () const
| Replaces databaseName with databaseNameFace.
QString | getCoreDatabaseNameOrDir () const
QString | getFaceDatabaseNameOrDir () const
QString | getSimilarityDatabaseNameOrDir () const
QString | getThumbsDatabaseNameOrDir () const
QByteArray | hash () const
| Creates a unique hash of the values stored in this object.
void | insertInUrl (QUrl &url) const
QString | internalServerPath () const
bool | isMySQL () const
bool | isSQLite () const
bool | isValid () const
| Performs basic checks that the parameters are not empty and have the information required for the databaseType.
void | legacyAndDefaultChecks (const QString &suggestedPath=QString())
bool | operator!= (const DbEngineParameters &other) const
bool | operator== (const DbEngineParameters &other) const
void | readFromConfig (const QString &configGroup=QString())
| Read and write parameters from config.
void | removeLegacyConfig ()
void | setCoreDatabasePath (const QString &folderOrFileOrName)
| Use these methods if you set a file or a folder.
void | setFaceDatabasePath (const QString &folderOrFileOrName)
void | setInternalServerPath (const QString &path)
| For Mysql internal server: manage the database path to store database files.
void | setSimilarityDatabasePath (const QString &folderOrFileOrName)
void | setThumbsDatabasePath (const QString &folderOrFileOrName)
DbEngineParameters | similarityParameters () const
| Replaces databaseName with databaseNameFace.
QString | SQLiteDatabaseFile () const
DbEngineParameters | thumbnailParameters () const
| Replaces databaseName with databaseNameThumbnails.
void | writeToConfig (const QString &configGroup=QString()) const

## Static Public Member Functions
static QString | coreDatabaseDirectorySQLite (const QString &path)
static QString | coreDatabaseFileSQLite (const QString &folderOrFile)
static QString | defaultMysqlAdminCmd ()
| Return the default Mysql server administration name (Internal server only).
static QString | defaultMysqlInitCmd ()
| Return the default Mysql initialization command name (Internal server only).
static QString | defaultMysqlServerCmd ()
| Return the default Mysql server command name (Internal server only).
static QString | defaultMysqlUpgradeCmd ()
| Return the default Mysql upgrade command name (Internal server only).
static DbEngineParameters | defaultParameters (const QString &databaseType)
| Return a set of default parameters for the given type.
static QString | faceDatabaseDirectorySQLite (const QString &path)
static QString | faceDatabaseFileSQLite (const QString &folderOrFile)
static QString | MySQLDatabaseType ()
static DbEngineParameters | parametersForSQLite (const QString &databaseFile)
| Convenience methods to create a DbEngineParameters object for an SQLITE database specified by the local file path.
static DbEngineParameters | parametersForSQLiteDefaultFile (const QString &directory)
static DbEngineParameters | parametersFromConfig (const QString &configGroup=QString())
static void | removeFromUrl (QUrl &url)
static QString | serverPrivatePath ()
| Return the hidden path from home directory to store private data used by internal Mysql server.
static QString | similarityDatabaseDirectorySQLite (const QString &path)
static QString | similarityDatabaseFileSQLite (const QString &folderOrFile)
static QString | SQLiteDatabaseType ()
| Returns the databaseType designating the said database.
static QString | thumbnailDatabaseDirectorySQLite (const QString &path)
static QString | thumbnailDatabaseFileSQLite (const QString &folderOrFile)

## Public Attributes
QString | connectOptions
QString | databaseNameCore
QString | databaseNameFace
QString | databaseNameSimilarity
QString | databaseNameThumbnails
QString | databaseType
QString | hostName
bool | internalServer = false
QString | internalServerDBPath
QString | internalServerMysqlAdminCmd
QString | internalServerMysqlInitCmd
| Settings stored in config file and used only with internal server at runtime to start server instance or init database tables.
QString | internalServerMysqlServerCmd
QString | internalServerMysqlUpgradeCmd
QString | password
int | port = -1
QString | userName
bool | walMode = false

## Detailed Description

The values can be read from and written to a QUrl.

## Member Function Documentation

## ◆ defaultParameters()

DbEngineParameters Digikam::DbEngineParameters::defaultParameters | ( | const QString & | databaseType | ) |
| static

For Mysql, it return internal server configuration.

## ◆ getCoreDatabaseNameOrDir()

QString Digikam::DbEngineParameters::getCoreDatabaseNameOrDir | ( |  | ) | const

Note
  In case of SQLite, the database name typically is a file. For non-SQLite, this simply handle the database name.

## ◆ readFromConfig()

void Digikam::DbEngineParameters::readFromConfig | ( | const QString & | configGroup = `QString()` | ) |

You can specify the group, or use the default value.

## ◆ SQLiteDatabaseType()

QString Digikam::DbEngineParameters::SQLiteDatabaseType | ( |  | ) |
| static

If you have a DbEngineParameters object already, you can use isSQLite() as well. These strings are identical to the driver identifiers in the Qt SQL module.