digiKam
|
Public Member Functions | |
DbEngineParameters () | |
DbEngineParameters (const QString &_type, const QString &_databaseNameCore, const QString &_connectOptions=QString(), const QString &_hostName=QString(), int _port=-1, 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 &_internalServerMysqlAdminCmd=QString(), const QString &_internalServerMysqlServCmd=QString(), const QString &_internalServerMysqlInitCmd=QString()) | |
DbEngineParameters (const QUrl &url) | |
DbEngineParameters | faceParameters () const |
QString | getCoreDatabaseNameOrDir () const |
QString | getFaceDatabaseNameOrDir () const |
QString | getSimilarityDatabaseNameOrDir () const |
QString | getThumbsDatabaseNameOrDir () const |
QByteArray | hash () const |
void | insertInUrl (QUrl &url) const |
QString | internalServerPath () const |
bool | isMySQL () const |
bool | isSQLite () const |
bool | isValid () const |
void | legacyAndDefaultChecks (const QString &suggestedPath=QString()) |
bool | operator!= (const DbEngineParameters &other) const |
bool | operator== (const DbEngineParameters &other) const |
void | readFromConfig (const QString &configGroup=QString()) |
void | removeLegacyConfig () |
void | setCoreDatabasePath (const QString &folderOrFileOrName) |
void | setFaceDatabasePath (const QString &folderOrFileOrName) |
void | setInternalServerPath (const QString &path) |
void | setSimilarityDatabasePath (const QString &folderOrFileOrName) |
void | setThumbsDatabasePath (const QString &folderOrFileOrName) |
DbEngineParameters | similarityParameters () const |
QString | SQLiteDatabaseFile () const |
DbEngineParameters | thumbnailParameters () const |
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 () |
static QString | defaultMysqlInitCmd () |
static QString | defaultMysqlServerCmd () |
static DbEngineParameters | defaultParameters (const QString &databaseType) |
static QString | faceDatabaseDirectorySQLite (const QString &path) |
static QString | faceDatabaseFileSQLite (const QString &folderOrFile) |
static QString | internalServerPrivatePath () |
static QString | MySQLDatabaseType () |
static DbEngineParameters | parametersForSQLite (const QString &databaseFile) |
static DbEngineParameters | parametersForSQLiteDefaultFile (const QString &directory) |
static DbEngineParameters | parametersFromConfig (const QString &configGroup=QString()) |
static void | removeFromUrl (QUrl &url) |
static QString | similarityDatabaseDirectorySQLite (const QString &path) |
static QString | similarityDatabaseFileSQLite (const QString &folderOrFile) |
static QString | SQLiteDatabaseType () |
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 |
QString | internalServerDBPath |
QString | internalServerMysqlAdminCmd |
QString | internalServerMysqlInitCmd |
QString | internalServerMysqlServCmd |
QString | password |
int | port |
QString | userName |
This class encapsulates all parameters needed to establish a connection to a database (inspired by the API of Qt::Sql). The values can be read from and written to a QUrl.
Digikam::DbEngineParameters::DbEngineParameters | ( | const QString & | _type, |
const QString & | _databaseNameCore, | ||
const QString & | _connectOptions = QString() , |
||
const QString & | _hostName = QString() , |
||
int | _port = -1 , |
||
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 & | _internalServerMysqlAdminCmd = QString() , |
||
const QString & | _internalServerMysqlServCmd = QString() , |
||
const QString & | _internalServerMysqlInitCmd = QString() |
||
) |
Digikam::DbEngineParameters::DbEngineParameters | ( | ) |
|
explicit |
QUrl helpers.
References internalServer, internalServerDBPath, internalServerMysqlAdminCmd, internalServerMysqlInitCmd, internalServerMysqlServCmd, internalServerPrivatePath(), password, port, and userName.
|
static |
Referenced by getCoreDatabaseNameOrDir().
|
static |
Referenced by legacyAndDefaultChecks(), and setCoreDatabasePath().
|
static |
Return the default Mysql server administration name (Internal server only).
Referenced by defaultParameters(), and readFromConfig().
|
static |
Return the default Mysql initialization command name (Internal server only).
Referenced by defaultParameters(), and readFromConfig().
|
static |
Return the default Mysql server command name (Internal server only).
Referenced by defaultParameters(), and readFromConfig().
|
static |
Return a set of default parameters for the given type. For Mysql, it return internal server configuration.
References Digikam::DbEngineConfigSettings::connectOptions, connectOptions, Digikam::DbEngineConfigSettings::databaseName, databaseNameCore, databaseNameFace, databaseNameSimilarity, databaseNameThumbnails, databaseType, defaultMysqlAdminCmd(), defaultMysqlInitCmd(), defaultMysqlServerCmd(), Digikam::DbEngineConfig::element(), Digikam::DbEngineConfigSettings::hostName, hostName, internalServer, internalServerDBPath, internalServerMysqlAdminCmd, internalServerMysqlInitCmd, internalServerMysqlServCmd, internalServerPrivatePath(), Digikam::DbEngineConfigSettings::password, password, Digikam::DbEngineConfigSettings::port, port, Digikam::DbEngineConfigSettings::userName, and userName.
Referenced by Digikam::DatabaseSettingsWidget::getDbEngineParameters().
|
static |
Referenced by getFaceDatabaseNameOrDir().
|
static |
Referenced by setFaceDatabasePath().
DbEngineParameters Digikam::DbEngineParameters::faceParameters | ( | ) | const |
Replaces databaseName with databaseNameFace.
References databaseNameCore, and databaseNameFace.
Referenced by Digikam::FacialRecognitionWrapper::Private::Private().
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.
References coreDatabaseDirectorySQLite(), databaseNameCore, and isSQLite().
Referenced by Digikam::AlbumManager::changeDatabase(), Digikam::DBStatDlg::DBStatDlg(), main(), parametersForSQLite(), Digikam::DatabaseSettingsWidget::setParametersFromSettings(), and writeToConfig().
QString Digikam::DbEngineParameters::getFaceDatabaseNameOrDir | ( | ) | const |
References databaseNameFace, faceDatabaseDirectorySQLite(), and isSQLite().
Referenced by writeToConfig().
QString Digikam::DbEngineParameters::getSimilarityDatabaseNameOrDir | ( | ) | const |
References databaseNameSimilarity, isSQLite(), and similarityDatabaseDirectorySQLite().
Referenced by writeToConfig().
QString Digikam::DbEngineParameters::getThumbsDatabaseNameOrDir | ( | ) | const |
References databaseNameThumbnails, isSQLite(), and thumbnailDatabaseDirectorySQLite().
Referenced by writeToConfig().
QByteArray Digikam::DbEngineParameters::hash | ( | ) | const |
Creates a unique hash of the values stored in this object.
References connectOptions, databaseNameCore, databaseNameFace, databaseNameSimilarity, databaseNameThumbnails, databaseType, hostName, internalServer, internalServerDBPath, password, port, and userName.
void Digikam::DbEngineParameters::insertInUrl | ( | QUrl & | url | ) | const |
References connectOptions, databaseNameCore, databaseNameFace, databaseNameSimilarity, databaseNameThumbnails, databaseType, hostName, internalServer, internalServerDBPath, internalServerMysqlAdminCmd, internalServerMysqlInitCmd, internalServerMysqlServCmd, password, port, removeFromUrl(), and userName.
Referenced by Digikam::CoreDbUrl::setParameters().
QString Digikam::DbEngineParameters::internalServerPath | ( | ) | const |
References internalServerDBPath.
Referenced by Digikam::AlbumManager::setDatabase(), and Digikam::DatabaseSettingsWidget::setParametersFromSettings().
|
static |
Return the hidden path from home directory to store private data used by internal Mysql server.
Referenced by Digikam::DatabaseServer::DatabaseServer(), DbEngineParameters(), defaultParameters(), legacyAndDefaultChecks(), and readFromConfig().
bool Digikam::DbEngineParameters::isMySQL | ( | ) | const |
References databaseType.
Referenced by Digikam::BdEngineBackendPrivate::reconnectOnError(), and Digikam::AlbumManager::setDatabase().
bool Digikam::DbEngineParameters::isSQLite | ( | ) | const |
References databaseType.
Referenced by Digikam::AlbumManager::changeDatabase(), Digikam::BdEngineBackendPrivate::createDatabaseConnection(), getCoreDatabaseNameOrDir(), getFaceDatabaseNameOrDir(), getSimilarityDatabaseNameOrDir(), getThumbsDatabaseNameOrDir(), Digikam::BdEngineBackendPrivate::isConnectionError(), Digikam::BdEngineBackendPrivate::isSQLiteLockError(), Digikam::BdEngineBackendPrivate::isSQLiteLockTransactionError(), isValid(), main(), readFromConfig(), setCoreDatabasePath(), Digikam::AlbumManager::setDatabase(), Digikam::AlbumWatch::setDbEngineParameters(), setFaceDatabasePath(), setSimilarityDatabasePath(), setThumbsDatabasePath(), and SQLiteDatabaseFile().
bool Digikam::DbEngineParameters::isValid | ( | ) | const |
Performs basic checks that the parameters are not empty and have the information required for the databaseType.
References databaseNameCore, and isSQLite().
void Digikam::DbEngineParameters::legacyAndDefaultChecks | ( | const QString & | suggestedPath = QString() | ) |
References connectOptions, coreDatabaseFileSQLite(), databaseNameCore, databaseNameFace, databaseNameSimilarity, databaseNameThumbnails, databaseType, hostName, internalServer, internalServerPrivatePath(), parametersForSQLite(), password, port, and userName.
Referenced by main().
|
static |
bool Digikam::DbEngineParameters::operator!= | ( | const DbEngineParameters & | other | ) | const |
bool Digikam::DbEngineParameters::operator== | ( | const DbEngineParameters & | other | ) | const |
|
static |
Convenience methods to create a DbEngineParameters object for an SQLITE database specified by the local file path.
References getCoreDatabaseNameOrDir(), setCoreDatabasePath(), setFaceDatabasePath(), setSimilarityDatabasePath(), and setThumbsDatabasePath().
Referenced by legacyAndDefaultChecks(), and parametersForSQLiteDefaultFile().
|
static |
References parametersForSQLite().
Referenced by Digikam::AlbumManager::checkDatabaseDirsAfterFirstRun(), and Digikam::DatabaseSettingsWidget::getDbEngineParameters().
|
static |
References readFromConfig().
Referenced by Digikam::DbEngineAccess::checkReadyForUse(), and Digikam::MigrateFromDigikam4Page::doMigration().
void Digikam::DbEngineParameters::readFromConfig | ( | const QString & | configGroup = QString() | ) |
Read and write parameters from config. You can specify the group, or use the default value.
References connectOptions, databaseNameCore, databaseNameFace, databaseNameSimilarity, databaseNameThumbnails, databaseType, defaultMysqlAdminCmd(), defaultMysqlInitCmd(), defaultMysqlServerCmd(), hostName, internalServer, internalServerDBPath, internalServerMysqlAdminCmd, internalServerMysqlInitCmd, internalServerMysqlServCmd, internalServerPrivatePath(), isSQLite(), password, port, setCoreDatabasePath(), setFaceDatabasePath(), setSimilarityDatabasePath(), setThumbsDatabasePath(), and userName.
Referenced by parametersFromConfig(), and Digikam::ApplicationSettings::readSettings().
|
static |
Referenced by insertInUrl().
void Digikam::DbEngineParameters::removeLegacyConfig | ( | ) |
void Digikam::DbEngineParameters::setCoreDatabasePath | ( | const QString & | folderOrFileOrName | ) |
Use these methods if you set a file or a folder.
References coreDatabaseFileSQLite(), databaseNameCore, and isSQLite().
Referenced by parametersForSQLite(), and readFromConfig().
void Digikam::DbEngineParameters::setFaceDatabasePath | ( | const QString & | folderOrFileOrName | ) |
References databaseNameFace, faceDatabaseFileSQLite(), and isSQLite().
Referenced by parametersForSQLite(), Digikam::FacialRecognitionWrapper::Private::Private(), and readFromConfig().
void Digikam::DbEngineParameters::setInternalServerPath | ( | const QString & | path | ) |
For Mysql internal server: manage the database path to store database files.
References internalServerDBPath.
Referenced by Digikam::DatabaseSettingsWidget::getDbEngineParameters().
void Digikam::DbEngineParameters::setSimilarityDatabasePath | ( | const QString & | folderOrFileOrName | ) |
References databaseNameSimilarity, isSQLite(), and similarityDatabaseFileSQLite().
Referenced by parametersForSQLite(), and readFromConfig().
void Digikam::DbEngineParameters::setThumbsDatabasePath | ( | const QString & | folderOrFileOrName | ) |
References databaseNameThumbnails, isSQLite(), and thumbnailDatabaseFileSQLite().
Referenced by parametersForSQLite(), and readFromConfig().
|
static |
Referenced by getSimilarityDatabaseNameOrDir().
|
static |
Referenced by setSimilarityDatabasePath().
DbEngineParameters Digikam::DbEngineParameters::similarityParameters | ( | ) | const |
Replaces databaseName with databaseNameFace.
References databaseNameCore, and databaseNameSimilarity.
Referenced by Digikam::AlbumManager::setDatabase().
QString Digikam::DbEngineParameters::SQLiteDatabaseFile | ( | ) | const |
References databaseNameCore, and isSQLite().
Referenced by Digikam::AlbumManager::changeDatabase(), Digikam::AlbumManager::checkDatabaseDirsAfterFirstRun(), and Digikam::AlbumWatch::setDbEngineParameters().
|
static |
Returns the databaseType designating the said database. 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.
Referenced by Digikam::DbEngineAccess::checkReadyForUse(), Digikam::DatabaseSettingsWidget::databaseBackend(), and Digikam::DatabaseSettingsWidget::setParametersFromSettings().
|
static |
Referenced by getThumbsDatabaseNameOrDir().
|
static |
Referenced by Digikam::ThumbsDbAccess::setParameters(), and setThumbsDatabasePath().
DbEngineParameters Digikam::DbEngineParameters::thumbnailParameters | ( | ) | const |
Replaces databaseName with databaseNameThumbnails.
References databaseNameCore, and databaseNameThumbnails.
void Digikam::DbEngineParameters::writeToConfig | ( | const QString & | configGroup = QString() | ) | const |
References connectOptions, databaseType, getCoreDatabaseNameOrDir(), getFaceDatabaseNameOrDir(), getSimilarityDatabaseNameOrDir(), getThumbsDatabaseNameOrDir(), hostName, internalServer, internalServerDBPath, internalServerMysqlAdminCmd, internalServerMysqlInitCmd, internalServerMysqlServCmd, password, port, and userName.
Referenced by main(), Digikam::ApplicationSettings::saveSettings(), and Digikam::DatabasePage::saveSettings().
QString Digikam::DbEngineParameters::connectOptions |
Referenced by Digikam::BdEngineBackendPrivate::createDatabaseConnection(), Digikam::DBStatDlg::DBStatDlg(), defaultParameters(), Digikam::MigrateFromDigikam4Page::doMigration(), Digikam::DatabaseSettingsWidget::getDbEngineParameters(), hash(), insertInUrl(), legacyAndDefaultChecks(), Digikam::operator<<(), operator==(), readFromConfig(), Digikam::DatabaseSettingsWidget::setParametersFromSettings(), and writeToConfig().
QString Digikam::DbEngineParameters::databaseNameCore |
Referenced by Digikam::BdEngineBackendPrivate::createDatabaseConnection(), Digikam::DBStatDlg::DBStatDlg(), defaultParameters(), Digikam::MigrateFromDigikam4Page::doMigration(), faceParameters(), getCoreDatabaseNameOrDir(), Digikam::DatabaseSettingsWidget::getDbEngineParameters(), hash(), insertInUrl(), isValid(), legacyAndDefaultChecks(), Digikam::operator<<(), operator==(), readFromConfig(), setCoreDatabasePath(), Digikam::AlbumManager::setDatabase(), Digikam::DatabaseSettingsWidget::setParametersFromSettings(), similarityParameters(), SQLiteDatabaseFile(), and thumbnailParameters().
QString Digikam::DbEngineParameters::databaseNameFace |
Referenced by Digikam::DBStatDlg::DBStatDlg(), defaultParameters(), faceParameters(), Digikam::DatabaseSettingsWidget::getDbEngineParameters(), getFaceDatabaseNameOrDir(), hash(), insertInUrl(), legacyAndDefaultChecks(), Digikam::operator<<(), operator==(), readFromConfig(), setFaceDatabasePath(), and Digikam::DatabaseSettingsWidget::setParametersFromSettings().
QString Digikam::DbEngineParameters::databaseNameSimilarity |
Referenced by defaultParameters(), Digikam::DatabaseSettingsWidget::getDbEngineParameters(), getSimilarityDatabaseNameOrDir(), hash(), insertInUrl(), legacyAndDefaultChecks(), Digikam::operator<<(), operator==(), readFromConfig(), Digikam::DatabaseSettingsWidget::setParametersFromSettings(), setSimilarityDatabasePath(), and similarityParameters().
QString Digikam::DbEngineParameters::databaseNameThumbnails |
Referenced by Digikam::DBStatDlg::DBStatDlg(), defaultParameters(), Digikam::DatabaseSettingsWidget::getDbEngineParameters(), getThumbsDatabaseNameOrDir(), hash(), insertInUrl(), legacyAndDefaultChecks(), Digikam::operator<<(), operator==(), readFromConfig(), Digikam::DatabaseSettingsWidget::setParametersFromSettings(), setThumbsDatabasePath(), and thumbnailParameters().
QString Digikam::DbEngineParameters::databaseType |
Referenced by Digikam::BdEngineBackendPrivate::createDatabaseConnection(), Digikam::DBStatDlg::DBStatDlg(), defaultParameters(), Digikam::MigrateFromDigikam4Page::doMigration(), Digikam::DatabaseSettingsWidget::getDbEngineParameters(), hash(), insertInUrl(), Digikam::BdEngineBackend::isCompatible(), isMySQL(), isSQLite(), legacyAndDefaultChecks(), Digikam::operator<<(), operator==(), readFromConfig(), Digikam::DatabaseSettingsWidget::setParametersFromSettings(), and writeToConfig().
QString Digikam::DbEngineParameters::hostName |
Referenced by Digikam::BdEngineBackendPrivate::createDatabaseConnection(), Digikam::DBStatDlg::DBStatDlg(), defaultParameters(), Digikam::MigrateFromDigikam4Page::doMigration(), Digikam::DatabaseSettingsWidget::getDbEngineParameters(), hash(), insertInUrl(), legacyAndDefaultChecks(), Digikam::operator<<(), operator==(), readFromConfig(), Digikam::DatabaseSettingsWidget::setParametersFromSettings(), and writeToConfig().
bool Digikam::DbEngineParameters::internalServer |
Referenced by DbEngineParameters(), Digikam::DBStatDlg::DBStatDlg(), defaultParameters(), Digikam::DatabaseSettingsWidget::getDbEngineParameters(), hash(), insertInUrl(), legacyAndDefaultChecks(), Digikam::operator<<(), operator==(), readFromConfig(), Digikam::AlbumManager::setDatabase(), Digikam::DatabaseSettingsWidget::setParametersFromSettings(), and writeToConfig().
QString Digikam::DbEngineParameters::internalServerDBPath |
QString Digikam::DbEngineParameters::internalServerMysqlAdminCmd |
Settings stored in config file and used only with internal server at runtime to start server instance or init database tables.
Referenced by DbEngineParameters(), defaultParameters(), Digikam::DatabaseSettingsWidget::getDbEngineParameters(), insertInUrl(), Digikam::operator<<(), operator==(), readFromConfig(), Digikam::AlbumManager::setDatabase(), Digikam::DatabaseSettingsWidget::setParametersFromSettings(), and writeToConfig().
QString Digikam::DbEngineParameters::internalServerMysqlInitCmd |
QString Digikam::DbEngineParameters::internalServerMysqlServCmd |
Referenced by DbEngineParameters(), defaultParameters(), Digikam::DatabaseSettingsWidget::getDbEngineParameters(), insertInUrl(), Digikam::operator<<(), operator==(), readFromConfig(), Digikam::AlbumManager::setDatabase(), Digikam::DatabaseSettingsWidget::setParametersFromSettings(), and writeToConfig().
QString Digikam::DbEngineParameters::password |
Referenced by Digikam::BdEngineBackendPrivate::createDatabaseConnection(), DbEngineParameters(), defaultParameters(), Digikam::MigrateFromDigikam4Page::doMigration(), Digikam::DatabaseSettingsWidget::getDbEngineParameters(), hash(), insertInUrl(), legacyAndDefaultChecks(), Digikam::operator<<(), operator==(), readFromConfig(), Digikam::DatabaseSettingsWidget::setParametersFromSettings(), and writeToConfig().
int Digikam::DbEngineParameters::port |
Referenced by Digikam::BdEngineBackendPrivate::createDatabaseConnection(), DbEngineParameters(), Digikam::DBStatDlg::DBStatDlg(), defaultParameters(), Digikam::MigrateFromDigikam4Page::doMigration(), Digikam::DatabaseSettingsWidget::getDbEngineParameters(), hash(), insertInUrl(), legacyAndDefaultChecks(), Digikam::operator<<(), operator==(), readFromConfig(), Digikam::DatabaseSettingsWidget::setParametersFromSettings(), and writeToConfig().
QString Digikam::DbEngineParameters::userName |
Referenced by Digikam::BdEngineBackendPrivate::createDatabaseConnection(), DbEngineParameters(), Digikam::DBStatDlg::DBStatDlg(), defaultParameters(), Digikam::MigrateFromDigikam4Page::doMigration(), Digikam::DatabaseSettingsWidget::getDbEngineParameters(), hash(), insertInUrl(), legacyAndDefaultChecks(), Digikam::operator<<(), operator==(), readFromConfig(), Digikam::DatabaseSettingsWidget::setParametersFromSettings(), and writeToConfig().