digiKam
|
Classes | |
class | QueryState |
Public Types | |
enum | DbType { SQLite , MySQL } |
enum | QueryOperationStatus { ExecuteNormal , Wait , AbortQueries } |
enum | QueryStateEnum { NoErrors , SQLError , ConnectionError } |
enum | Status { Unavailable , Open , OpenSchemaChecked } |
Public Member Functions | |
BdEngineBackend (const QString &backendName, DbEngineLocking *const locking) | |
BdEngineBackend (const QString &backendName, DbEngineLocking *const locking, BdEngineBackendPrivate &dd) | |
BdEngineBackend::QueryState | beginTransaction () |
void | close () |
BdEngineBackend::QueryState | commitTransaction () |
DbEngineConfigSettings | configElement () const |
bool | connectionErrorHandling (int retries) |
DbEngineSqlQuery | copyQuery (const DbEngineSqlQuery &old) |
DbType | databaseType () const |
bool | exec (DbEngineSqlQuery &query) |
bool | execBatch (DbEngineSqlQuery &query) |
QueryState | execDBAction (const DbEngineAction &action, const QMap< QString, QVariant > &bindingMap, QList< QVariant > *const values=nullptr, QVariant *const lastInsertId=nullptr) |
QueryState | execDBAction (const DbEngineAction &action, QList< QVariant > *const values=nullptr, QVariant *const lastInsertId=nullptr) |
QueryState | execDBAction (const QString &action, const QMap< QString, QVariant > &bindingMap, QList< QVariant > *const values=nullptr, QVariant *const lastInsertId=nullptr) |
QueryState | execDBAction (const QString &action, QList< QVariant > *const values=nullptr, QVariant *const lastInsertId=nullptr) |
QSqlQuery | execDBActionQuery (const DbEngineAction &action, const QMap< QString, QVariant > &bindingMap) |
QSqlQuery | execDBActionQuery (const QString &action, const QMap< QString, QVariant > &bindingMap) |
QueryState | execDirectSql (const QString &query) |
QueryState | execDirectSqlWithResult (const QString &query, QList< QVariant > *const values=nullptr, QVariant *const lastInsertId=nullptr) |
DbEngineSqlQuery | execQuery (const QString &sql) |
DbEngineSqlQuery | execQuery (const QString &sql, const QList< QVariant > &boundValues) |
DbEngineSqlQuery | execQuery (const QString &sql, const QMap< QString, QVariant > &bindingMap) |
DbEngineSqlQuery | execQuery (const QString &sql, const QVariant &boundValue1) |
DbEngineSqlQuery | execQuery (const QString &sql, const QVariant &boundValue1, const QVariant &boundValue2) |
DbEngineSqlQuery | execQuery (const QString &sql, const QVariant &boundValue1, const QVariant &boundValue2, const QVariant &boundValue3) |
DbEngineSqlQuery | execQuery (const QString &sql, const QVariant &boundValue1, const QVariant &boundValue2, const QVariant &boundValue3, const QVariant &boundValue4) |
void | execQuery (DbEngineSqlQuery &preparedQuery, const QList< QVariant > &boundValues) |
void | execQuery (DbEngineSqlQuery &preparedQuery, const QVariant &boundValue1) |
void | execQuery (DbEngineSqlQuery &preparedQuery, const QVariant &boundValue1, const QVariant &boundValue2) |
void | execQuery (DbEngineSqlQuery &preparedQuery, const QVariant &boundValue1, const QVariant &boundValue2, const QVariant &boundValue3) |
void | execQuery (DbEngineSqlQuery &preparedQuery, const QVariant &boundValue1, const QVariant &boundValue2, const QVariant &boundValue3, const QVariant &boundValue4) |
QueryState | execSql (const QString &sql, const QList< QVariant > &boundValues, QList< QVariant > *const values=nullptr, QVariant *const lastInsertId=nullptr) |
QueryState | execSql (const QString &sql, const QMap< QString, QVariant > &bindingMap, QList< QVariant > *const values=nullptr, QVariant *const lastInsertId=nullptr) |
QueryState | execSql (const QString &sql, const QVariant &boundValue1, const QVariant &boundValue2, const QVariant &boundValue3, const QVariant &boundValue4, QList< QVariant > *const values=nullptr, QVariant *const lastInsertId=nullptr) |
QueryState | execSql (const QString &sql, const QVariant &boundValue1, const QVariant &boundValue2, const QVariant &boundValue3, QList< QVariant > *const values=nullptr, QVariant *const lastInsertId=nullptr) |
QueryState | execSql (const QString &sql, const QVariant &boundValue1, const QVariant &boundValue2, QList< QVariant > *const values=nullptr, QVariant *const lastInsertId=nullptr) |
QueryState | execSql (const QString &sql, const QVariant &boundValue1, QList< QVariant > *const values=nullptr, QVariant *const lastInsertId=nullptr) |
QueryState | execSql (const QString &sql, QList< QVariant > *const values=nullptr, QVariant *const lastInsertId=nullptr) |
QueryState | execSql (DbEngineSqlQuery &preparedQuery, const QList< QVariant > &boundValues, QList< QVariant > *const values=nullptr, QVariant *const lastInsertId=nullptr) |
QueryState | execSql (DbEngineSqlQuery &preparedQuery, const QVariant &boundValue1, const QVariant &boundValue2, const QVariant &boundValue3, const QVariant &boundValue4, QList< QVariant > *const values=nullptr, QVariant *const lastInsertId=nullptr) |
QueryState | execSql (DbEngineSqlQuery &preparedQuery, const QVariant &boundValue1, const QVariant &boundValue2, const QVariant &boundValue3, QList< QVariant > *const values=nullptr, QVariant *const lastInsertId=nullptr) |
QueryState | execSql (DbEngineSqlQuery &preparedQuery, const QVariant &boundValue1, const QVariant &boundValue2, QList< QVariant > *const values=nullptr, QVariant *const lastInsertId=nullptr) |
QueryState | execSql (DbEngineSqlQuery &preparedQuery, const QVariant &boundValue1, QList< QVariant > *const values=nullptr, QVariant *const lastInsertId=nullptr) |
QueryState | execSql (DbEngineSqlQuery &preparedQuery, QList< QVariant > *const values=nullptr, QVariant *const lastInsertId=nullptr) |
QueryState | execUpsertDBAction (const DbEngineAction &action, const QVariant &id, const QStringList &fieldNames, const QList< QVariant > &values) |
QueryState | execUpsertDBAction (const QString &action, const QVariant &id, const QStringList &fieldNames, const QList< QVariant > &values) |
DbEngineAction | getDBAction (const QString &actionName) const |
DbEngineSqlQuery | getQuery () |
QueryState | handleQueryResult (DbEngineSqlQuery &query, QList< QVariant > *const values, QVariant *const lastInsertId) |
bool | isCompatible (const DbEngineParameters ¶meters) |
bool | isInTransaction () const |
bool | isOpen () const |
bool | isReady () const |
QString | lastError () |
QSqlError | lastSQLError () |
int | maximumBoundValues () const |
bool | open (const DbEngineParameters ¶meters) |
DbEngineSqlQuery | prepareQuery (const QString &sql) |
bool | queryErrorHandling (DbEngineSqlQuery &query, int retries) |
QList< QVariant > | readToList (DbEngineSqlQuery &query) |
void | rollbackTransaction () |
void | setDbEngineErrorHandler (DbEngineErrorHandler *const handler) |
void | setForeignKeyChecks (bool check) |
Status | status () const |
QStringList | tables () |
bool | transactionErrorHandling (const QSqlError &lastError, int retries) |
~BdEngineBackend () override | |
Protected Attributes | |
BdEngineBackendPrivate *const | d_ptr |
|
explicit |
Creates a database backend. The backend name is an arbitrary string that shall be unique for this backend object. It will be used to create unique connection names per backend and thread.
References d_ptr, and Digikam::BdEngineBackendPrivate::init().
Digikam::BdEngineBackend::BdEngineBackend | ( | const QString & | backendName, |
DbEngineLocking *const | locking, | ||
BdEngineBackendPrivate & | dd | ||
) |
References d_ptr, and Digikam::BdEngineBackendPrivate::init().
|
override |
References close().
BdEngineBackend::QueryState Digikam::BdEngineBackend::beginTransaction | ( | ) |
Begin a database transaction
References ConnectionError, NoErrors, SQLError, and transactionErrorHandling().
Referenced by Digikam::CoreDbTransaction::CoreDbTransaction(), and execDBAction().
void Digikam::BdEngineBackend::close | ( | ) |
Close the database connection. Shall only be called from the thread that called open().
References Unavailable.
Referenced by Digikam::CoreDbCopyManager::copyDatabases(), and ~BdEngineBackend().
BdEngineBackend::QueryState Digikam::BdEngineBackend::commitTransaction | ( | ) |
Commit the current database transaction
References ConnectionError, lastError(), NoErrors, SQLError, and transactionErrorHandling().
Referenced by execDBAction(), and Digikam::CoreDbTransaction::~CoreDbTransaction().
DbEngineConfigSettings Digikam::BdEngineBackend::configElement | ( | ) | const |
Return config read from XML, corresponding to this backend's database type.
References Digikam::DbEngineConfig::element().
Referenced by getDBAction().
bool Digikam::BdEngineBackend::connectionErrorHandling | ( | int | retries | ) |
Called when an attempted connection to the database failed. If it returns true, retry; if it returns false, bail out. Pass the number of connection retries to help with some decisions.
Referenced by open().
DbEngineSqlQuery Digikam::BdEngineBackend::copyQuery | ( | const DbEngineSqlQuery & | old | ) |
Creates a faithful copy of the passed query, with the current db connection.
References getQuery(), Digikam::DbEngineSqlQuery::lastQuery(), Digikam::DbEngineSqlQuery::prepare(), and value.
Referenced by queryErrorHandling().
BdEngineBackend::DbType Digikam::BdEngineBackend::databaseType | ( | ) | const |
Return the database type.
Referenced by Digikam::FaceDb::integrityCheck().
bool Digikam::BdEngineBackend::exec | ( | DbEngineSqlQuery & | query | ) |
Calls exec/execBatch on the query, and handles debug output if something went wrong
References queryErrorHandling().
Referenced by execQuery(), and execSql().
bool Digikam::BdEngineBackend::execBatch | ( | DbEngineSqlQuery & | query | ) |
References queryErrorHandling().
BdEngineBackend::QueryState Digikam::BdEngineBackend::execDBAction | ( | const DbEngineAction & | action, |
const QMap< QString, QVariant > & | bindingMap, | ||
QList< QVariant > *const | values = nullptr , |
||
QVariant *const | lastInsertId = nullptr |
||
) |
Performs the database action on the current database. Queries by the specified parameters can have named parameters which are substituted with values from the bindingMap parameter. The result values (if any) are stored within the values list.
References beginTransaction(), commitTransaction(), Digikam::DbEngineAction::dbActionElements, execDirectSql(), execDirectSqlWithResult(), execSql(), Digikam::DbEngineActionElement::mode, Digikam::DbEngineAction::mode, Digikam::DbEngineAction::name, NoErrors, SQLError, and Digikam::DbEngineActionElement::statement.
BdEngineBackend::QueryState Digikam::BdEngineBackend::execDBAction | ( | const DbEngineAction & | action, |
QList< QVariant > *const | values = nullptr , |
||
QVariant *const | lastInsertId = nullptr |
||
) |
Performs the database action on the current database. Queries by the specified parameters mustn't have named parameters. The result values (if any) are stored within the values list.
Referenced by Digikam::CoreDbPrivilegesChecker::checkPriv(), Digikam::CoreDbCopyManager::copyDatabases(), execDBAction(), execUpsertDBAction(), Digikam::FaceDb::integrityCheck(), Digikam::ItemLister::listTag(), Digikam::FaceDb::setSetting(), Digikam::FaceDb::setting(), and Digikam::FaceDb::vacuum().
BdEngineBackend::QueryState Digikam::BdEngineBackend::execDBAction | ( | const QString & | action, |
const QMap< QString, QVariant > & | bindingMap, | ||
QList< QVariant > *const | values = nullptr , |
||
QVariant *const | lastInsertId = nullptr |
||
) |
References execDBAction(), and getDBAction().
BdEngineBackend::QueryState Digikam::BdEngineBackend::execDBAction | ( | const QString & | action, |
QList< QVariant > *const | values = nullptr , |
||
QVariant *const | lastInsertId = nullptr |
||
) |
References execDBAction(), and getDBAction().
QSqlQuery Digikam::BdEngineBackend::execDBActionQuery | ( | const DbEngineAction & | action, |
const QMap< QString, QVariant > & | bindingMap | ||
) |
Performs the database action on the current database. Queries by the specified parameters can have named parameters which are substituted with values from the bindingMap parameter. The result values (if any) are stored within the values list. This method returns the last query, which is used to handle special cases.
References Digikam::DbEngineAction::dbActionElements, execQuery(), Digikam::DbEngineActionElement::mode, Digikam::DbEngineAction::name, and Digikam::DbEngineActionElement::statement.
Referenced by execDBActionQuery().
QSqlQuery Digikam::BdEngineBackend::execDBActionQuery | ( | const QString & | action, |
const QMap< QString, QVariant > & | bindingMap | ||
) |
References execDBActionQuery(), and getDBAction().
BdEngineBackend::QueryState Digikam::BdEngineBackend::execDirectSql | ( | const QString & | query | ) |
Calls exec on the query, and handles debug output if something went wrong. The query is not prepared, which can be fail in certain situations (e.g. trigger statements on QMYSQL).
References getQuery(), NoErrors, queryErrorHandling(), and SQLError.
Referenced by Digikam::CoreDbCopyManager::copyDatabases(), and execDBAction().
BdEngineBackend::QueryState Digikam::BdEngineBackend::execDirectSqlWithResult | ( | const QString & | query, |
QList< QVariant > *const | values = nullptr , |
||
QVariant *const | lastInsertId = nullptr |
||
) |
Calls exec on the query, and handles debug output if something went wrong. The query is not prepared, which can be fail in certain situations (e.g. trigger statements on QMYSQL).
References getQuery(), handleQueryResult(), NoErrors, queryErrorHandling(), and SQLError.
Referenced by execDBAction().
DbEngineSqlQuery Digikam::BdEngineBackend::execQuery | ( | const QString & | sql | ) |
Executes the statement and returns the query object. Methods are provided for up to four bound values (positional binding), or for a list of bound values.
References exec(), and prepareQuery().
Referenced by execDBActionQuery(), execQuery(), execSql(), Digikam::FaceDb::getClosestNeighborsTreeDb(), Digikam::FaceDb::insertFaceVector(), Digikam::FaceDb::insertToTreeDb(), Digikam::FaceDb::reconstructTree(), and Digikam::FaceDb::trainData().
DbEngineSqlQuery Digikam::BdEngineBackend::execQuery | ( | const QString & | sql, |
const QList< QVariant > & | boundValues | ||
) |
References execQuery(), and prepareQuery().
DbEngineSqlQuery Digikam::BdEngineBackend::execQuery | ( | const QString & | sql, |
const QMap< QString, QVariant > & | bindingMap | ||
) |
Method which accept a hashmap with key, values which are used for named binding
References exec(), Digikam::DbEngineActionType::getActionValue(), Digikam::DbEngineActionType::isValue(), prepareQuery(), value, and Digikam::DbEngineActionType::value().
DbEngineSqlQuery Digikam::BdEngineBackend::execQuery | ( | const QString & | sql, |
const QVariant & | boundValue1 | ||
) |
References execQuery(), and prepareQuery().
DbEngineSqlQuery Digikam::BdEngineBackend::execQuery | ( | const QString & | sql, |
const QVariant & | boundValue1, | ||
const QVariant & | boundValue2 | ||
) |
References execQuery(), and prepareQuery().
DbEngineSqlQuery Digikam::BdEngineBackend::execQuery | ( | const QString & | sql, |
const QVariant & | boundValue1, | ||
const QVariant & | boundValue2, | ||
const QVariant & | boundValue3 | ||
) |
References execQuery(), and prepareQuery().
DbEngineSqlQuery Digikam::BdEngineBackend::execQuery | ( | const QString & | sql, |
const QVariant & | boundValue1, | ||
const QVariant & | boundValue2, | ||
const QVariant & | boundValue3, | ||
const QVariant & | boundValue4 | ||
) |
References execQuery(), and prepareQuery().
void Digikam::BdEngineBackend::execQuery | ( | DbEngineSqlQuery & | preparedQuery, |
const QList< QVariant > & | boundValues | ||
) |
References exec().
void Digikam::BdEngineBackend::execQuery | ( | DbEngineSqlQuery & | preparedQuery, |
const QVariant & | boundValue1 | ||
) |
Binds the values and executes the prepared query.
References exec().
void Digikam::BdEngineBackend::execQuery | ( | DbEngineSqlQuery & | preparedQuery, |
const QVariant & | boundValue1, | ||
const QVariant & | boundValue2 | ||
) |
References exec().
void Digikam::BdEngineBackend::execQuery | ( | DbEngineSqlQuery & | preparedQuery, |
const QVariant & | boundValue1, | ||
const QVariant & | boundValue2, | ||
const QVariant & | boundValue3 | ||
) |
References exec().
void Digikam::BdEngineBackend::execQuery | ( | DbEngineSqlQuery & | preparedQuery, |
const QVariant & | boundValue1, | ||
const QVariant & | boundValue2, | ||
const QVariant & | boundValue3, | ||
const QVariant & | boundValue4 | ||
) |
References exec().
BdEngineBackend::QueryState Digikam::BdEngineBackend::execSql | ( | const QString & | sql, |
const QList< QVariant > & | boundValues, | ||
QList< QVariant > *const | values = nullptr , |
||
QVariant *const | lastInsertId = nullptr |
||
) |
References execQuery(), and handleQueryResult().
BdEngineBackend::QueryState Digikam::BdEngineBackend::execSql | ( | const QString & | sql, |
const QMap< QString, QVariant > & | bindingMap, | ||
QList< QVariant > *const | values = nullptr , |
||
QVariant *const | lastInsertId = nullptr |
||
) |
Method which accepts a map for named binding. For special cases it's also possible to add a DbEngineActionType which wraps another data object (also lists or maps) which can be used as field entry or as value (where it's prepared with positional binding). See more on DbEngineActionType class. If the wrapped data object is an instance of list, then the elements are separated by comma. If the wrapped data object is an instance of map, then the elements are inserted in the following way: key1=value1, key2=value2,...,keyN=valueN.
References execQuery(), and handleQueryResult().
BdEngineBackend::QueryState Digikam::BdEngineBackend::execSql | ( | const QString & | sql, |
const QVariant & | boundValue1, | ||
const QVariant & | boundValue2, | ||
const QVariant & | boundValue3, | ||
const QVariant & | boundValue4, | ||
QList< QVariant > *const | values = nullptr , |
||
QVariant *const | lastInsertId = nullptr |
||
) |
References execQuery(), and handleQueryResult().
BdEngineBackend::QueryState Digikam::BdEngineBackend::execSql | ( | const QString & | sql, |
const QVariant & | boundValue1, | ||
const QVariant & | boundValue2, | ||
const QVariant & | boundValue3, | ||
QList< QVariant > *const | values = nullptr , |
||
QVariant *const | lastInsertId = nullptr |
||
) |
References execQuery(), and handleQueryResult().
BdEngineBackend::QueryState Digikam::BdEngineBackend::execSql | ( | const QString & | sql, |
const QVariant & | boundValue1, | ||
const QVariant & | boundValue2, | ||
QList< QVariant > *const | values = nullptr , |
||
QVariant *const | lastInsertId = nullptr |
||
) |
References execQuery(), and handleQueryResult().
BdEngineBackend::QueryState Digikam::BdEngineBackend::execSql | ( | const QString & | sql, |
const QVariant & | boundValue1, | ||
QList< QVariant > *const | values = nullptr , |
||
QVariant *const | lastInsertId = nullptr |
||
) |
References execQuery(), and handleQueryResult().
BdEngineBackend::QueryState Digikam::BdEngineBackend::execSql | ( | const QString & | sql, |
QList< QVariant > *const | values = nullptr , |
||
QVariant *const | lastInsertId = nullptr |
||
) |
Executes the SQL statement, and write the returned data into the values list. If you are not interested in the returned data, set values to 0. Methods are provided for up to four bound values (positional binding), or for a list of bound values. If you want the last inserted id (and your query is suitable), set lastInsertId to the address of a QVariant. Additionally, methods are provided for prepared statements.
References execQuery(), and handleQueryResult().
Referenced by Digikam::FaceDb::addIdentity(), Digikam::FaceDb::clearDNNTraining(), Digikam::FaceDb::clearIdentities(), Digikam::FaceDb::clearTreeDb(), Digikam::FaceDb::deleteIdentity(), execDBAction(), Digikam::FaceDb::getNumberOfIdentities(), Digikam::FaceDb::identities(), Digikam::FaceDb::identityIds(), Digikam::ItemLister::listAreaRange(), Digikam::ItemLister::listDateRange(), Digikam::ItemLister::listFaces(), Digikam::ItemLister::listImageTagPropertySearch(), Digikam::ItemLister::listPAlbum(), Digikam::ItemLister::listSearch(), Digikam::HaarIface::retrieveSignatureFromDB(), setForeignKeyChecks(), and Digikam::FaceDb::updateIdentity().
BdEngineBackend::QueryState Digikam::BdEngineBackend::execSql | ( | DbEngineSqlQuery & | preparedQuery, |
const QList< QVariant > & | boundValues, | ||
QList< QVariant > *const | values = nullptr , |
||
QVariant *const | lastInsertId = nullptr |
||
) |
References execQuery(), and handleQueryResult().
BdEngineBackend::QueryState Digikam::BdEngineBackend::execSql | ( | DbEngineSqlQuery & | preparedQuery, |
const QVariant & | boundValue1, | ||
const QVariant & | boundValue2, | ||
const QVariant & | boundValue3, | ||
const QVariant & | boundValue4, | ||
QList< QVariant > *const | values = nullptr , |
||
QVariant *const | lastInsertId = nullptr |
||
) |
References execQuery(), and handleQueryResult().
BdEngineBackend::QueryState Digikam::BdEngineBackend::execSql | ( | DbEngineSqlQuery & | preparedQuery, |
const QVariant & | boundValue1, | ||
const QVariant & | boundValue2, | ||
const QVariant & | boundValue3, | ||
QList< QVariant > *const | values = nullptr , |
||
QVariant *const | lastInsertId = nullptr |
||
) |
References execQuery(), and handleQueryResult().
BdEngineBackend::QueryState Digikam::BdEngineBackend::execSql | ( | DbEngineSqlQuery & | preparedQuery, |
const QVariant & | boundValue1, | ||
const QVariant & | boundValue2, | ||
QList< QVariant > *const | values = nullptr , |
||
QVariant *const | lastInsertId = nullptr |
||
) |
References execQuery(), and handleQueryResult().
BdEngineBackend::QueryState Digikam::BdEngineBackend::execSql | ( | DbEngineSqlQuery & | preparedQuery, |
const QVariant & | boundValue1, | ||
QList< QVariant > *const | values = nullptr , |
||
QVariant *const | lastInsertId = nullptr |
||
) |
References execQuery(), and handleQueryResult().
BdEngineBackend::QueryState Digikam::BdEngineBackend::execSql | ( | DbEngineSqlQuery & | preparedQuery, |
QList< QVariant > *const | values = nullptr , |
||
QVariant *const | lastInsertId = nullptr |
||
) |
References exec(), and handleQueryResult().
BdEngineBackend::QueryState Digikam::BdEngineBackend::execUpsertDBAction | ( | const DbEngineAction & | action, |
const QVariant & | id, | ||
const QStringList & | fieldNames, | ||
const QList< QVariant > & | values | ||
) |
Performs a special DBAction that is usually needed to "INSERT or UPDATE" entries in a table. The corresponding DBAction must contain exactly the named parameters :id, :fieldValueList, :fieldList and :valueList. You pass the value to be bound to the ":id" field, then two lists of the same size: The first containing the field names, the second one containing the values as QVariants ready for binding.
References execDBAction(), Digikam::DbEngineActionType::fieldEntry(), and Digikam::DbEngineActionType::value().
Referenced by execUpsertDBAction().
BdEngineBackend::QueryState Digikam::BdEngineBackend::execUpsertDBAction | ( | const QString & | action, |
const QVariant & | id, | ||
const QStringList & | fieldNames, | ||
const QList< QVariant > & | values | ||
) |
References execUpsertDBAction(), and getDBAction().
DbEngineAction Digikam::BdEngineBackend::getDBAction | ( | const QString & | actionName | ) | const |
Returns a database action with name, specified in actionName, for the current database.
References configElement(), Digikam::DbEngineAction::name, and Digikam::DbEngineConfigSettings::sqlStatements.
Referenced by Digikam::CoreDbCopyManager::copyDatabases(), execDBAction(), execDBActionQuery(), execUpsertDBAction(), Digikam::FaceDb::integrityCheck(), Digikam::ItemLister::listTag(), Digikam::FaceDb::setSetting(), Digikam::FaceDb::setting(), and Digikam::FaceDb::vacuum().
DbEngineSqlQuery Digikam::BdEngineBackend::getQuery | ( | ) |
Creates an empty query object waiting for the statement
Referenced by copyQuery(), execDirectSql(), execDirectSqlWithResult(), and prepareQuery().
BdEngineBackend::QueryState Digikam::BdEngineBackend::handleQueryResult | ( | DbEngineSqlQuery & | query, |
QList< QVariant > *const | values, | ||
QVariant *const | lastInsertId | ||
) |
Checks if there was a connection error. If so BdEngineBackend::ConnectionError is returned. If not, the values are extracted from the query and inserted in the values list, the last insertion id is taken from the query and BdEngineBackend::NoErrors is returned.
References ConnectionError, NoErrors, readToList(), and SQLError.
Referenced by execDirectSqlWithResult(), and execSql().
bool Digikam::BdEngineBackend::isCompatible | ( | const DbEngineParameters & | parameters | ) |
Checks if the parameters can be used for this database backend.
References Digikam::DbEngineParameters::databaseType.
bool Digikam::BdEngineBackend::isInTransaction | ( | ) | const |
Returns if the database is in a different thread in a transaction. Note that a transaction does not require holding CoreDbAccess. Note that this does not give information about other processes locking the database.
|
inline |
|
inline |
QString Digikam::BdEngineBackend::lastError | ( | ) |
Returns a description of the last error that occurred on this database. Use CoreDbAccess::lastError for errors presented to the user. This error will be included in that message. It may be empty.
Referenced by commitTransaction(), Digikam::ItemLister::listImageTagPropertySearch(), Digikam::ItemLister::listSearch(), and transactionErrorHandling().
QSqlError Digikam::BdEngineBackend::lastSQLError | ( | ) |
Returns the last error that occurred on this database. Use CoreDbAccess::lastError for errors presented to the user. It may be empty.
Referenced by Digikam::CoreDbPrivilegesChecker::checkPriv().
int Digikam::BdEngineBackend::maximumBoundValues | ( | ) | const |
Returns the maximum number of bound parameters allowed per query. This value depends on the database engine.
Referenced by Digikam::ItemLister::listPAlbum().
bool Digikam::BdEngineBackend::open | ( | const DbEngineParameters & | parameters | ) |
Open the database connection.
References connectionErrorHandling(), and Open.
Referenced by Digikam::CoreDbPrivilegesChecker::checkPrivileges(), and Digikam::CoreDbCopyManager::copyDatabases().
DbEngineSqlQuery Digikam::BdEngineBackend::prepareQuery | ( | const QString & | sql | ) |
Creates a query object prepared with the statement, waiting for bound values
References getQuery(), Digikam::DbEngineSqlQuery::prepare(), and queryErrorHandling().
Referenced by execQuery(), and Digikam::HaarIface::Private::rebuildSignatureCache().
bool Digikam::BdEngineBackend::queryErrorHandling | ( | DbEngineSqlQuery & | query, |
int | retries | ||
) |
Called with a failed query. Handles certain known errors and debug output. If it returns true, reexecute the query; if it returns false, return it as failed. Pass the number of retries already done for this query to help with some decisions.
References copyQuery().
Referenced by exec(), execBatch(), execDirectSql(), execDirectSqlWithResult(), and prepareQuery().
QList< QVariant > Digikam::BdEngineBackend::readToList | ( | DbEngineSqlQuery & | query | ) |
Reads data of returned result set into a list which is returned. The read process is column wise, which means all data elements of a row is read, then the resultset is switched to the next row.
Referenced by handleQueryResult().
void Digikam::BdEngineBackend::rollbackTransaction | ( | ) |
Rollback the current database transaction
void Digikam::BdEngineBackend::setDbEngineErrorHandler | ( | DbEngineErrorHandler *const | handler | ) |
Add a DbEngineErrorHandler. This object must be created in the main thread. If a database error occurs, this object can handle problem solving and user interaction.
void Digikam::BdEngineBackend::setForeignKeyChecks | ( | bool | check | ) |
Enables or disables FOREIGN_KEY_CHECKS for the database. This function depends on the database engine.
References execSql().
BdEngineBackend::Status Digikam::BdEngineBackend::status | ( | ) | const |
Returns the current status of the database backend
QStringList Digikam::BdEngineBackend::tables | ( | ) |
Returns a list with the names of tables in the database.
bool Digikam::BdEngineBackend::transactionErrorHandling | ( | const QSqlError & | lastError, |
int | retries | ||
) |
References lastError().
Referenced by beginTransaction(), and commitTransaction().
|
protected |
Referenced by BdEngineBackend().