• Skip to content
  • Skip to link menu
KDE 4.5 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

digikam

Digikam::DatabaseCoreBackend

Digikam::DatabaseCoreBackend Class Reference

#include <databasecorebackend.h>

Inheritance diagram for Digikam::DatabaseCoreBackend:
Inheritance graph
[legend]

List of all members.

Public Types

enum  Status { Unavailable, Open, OpenSchemaChecked }

Public Member Functions

 DatabaseCoreBackend (const QString &backendName, DatabaseCoreBackendPrivate &dd)
 DatabaseCoreBackend (const QString &backendName)
 ~DatabaseCoreBackend ()
bool beginTransaction ()
void close ()
bool commitTransaction ()
bool exec (QSqlQuery &query)
bool execBatch (QSqlQuery &query)
QSqlQuery execQuery (const QString &sql, const QList< QVariant > &boundValues)
QSqlQuery execQuery (const QString &sql, const QVariant &boundValue1, const QVariant &boundValue2, const QVariant &boundValue3, const QVariant &boundValue4)
QSqlQuery execQuery (const QString &sql, const QVariant &boundValue1, const QVariant &boundValue2, const QVariant &boundValue3)
QSqlQuery execQuery (const QString &sql, const QVariant &boundValue1, const QVariant &boundValue2)
QSqlQuery execQuery (const QString &sql, const QVariant &boundValue1)
QSqlQuery execQuery (const QString &sql)
bool execSql (const QString &sql, const QList< QVariant > &boundValues, QList< QVariant > *values=0, QVariant *lastInsertId=0)
bool execSql (const QString &sql, const QVariant &boundValue1, const QVariant &boundValue2, const QVariant &boundValue3, const QVariant &boundValue4, QList< QVariant > *values=0, QVariant *lastInsertId=0)
bool execSql (const QString &sql, const QVariant &boundValue1, const QVariant &boundValue2, const QVariant &boundValue3, QList< QVariant > *values=0, QVariant *lastInsertId=0)
bool execSql (const QString &sql, const QVariant &boundValue1, const QVariant &boundValue2, QList< QVariant > *values=0, QVariant *lastInsertId=0)
bool execSql (const QString &sql, const QVariant &boundValue1, QList< QVariant > *values=0, QVariant *lastInsertId=0)
bool execSql (const QString &sql, QList< QVariant > *values=0, QVariant *lastInsertId=0)
bool initSchema (ThumbnailSchemaUpdater *updater)
bool isCompatible (const DatabaseParameters &parameters)
bool isInTransaction () const
bool isOpen () const
bool isReady () const
QString lastError ()
bool open (const DatabaseParameters &parameters)
QSqlQuery prepareQuery (const QString &sql)
QList< QVariant > readToList (QSqlQuery &query)
void rollbackTransaction ()
Status status () const
QStringList tables ()

Protected Attributes

DatabaseCoreBackendPrivate *const d_ptr

Detailed Description

Definition at line 45 of file databasecorebackend.h.


Member Enumeration Documentation

enum Digikam::DatabaseCoreBackend::Status
Enumerator:
Unavailable 

The database is not available, because it has not been opened yet or because of an error condition.

Open 

The database is open.

It has not been verified that the schema is up to date. This status is sufficient for use in a context where it can be assumed that the necessary schema check has been carried out by a master process.

OpenSchemaChecked 

The database is open, and it has been verified that the schema is up to date, or the schema has been updated.

Definition at line 84 of file databasecorebackend.h.


Constructor & Destructor Documentation

Digikam::DatabaseCoreBackend::DatabaseCoreBackend ( const QString &  backendName  ) 

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.

Definition at line 160 of file databasecorebackend.cpp.

Digikam::DatabaseCoreBackend::DatabaseCoreBackend ( const QString &  backendName,
DatabaseCoreBackendPrivate &  dd 
)

Definition at line 166 of file databasecorebackend.cpp.

Digikam::DatabaseCoreBackend::~DatabaseCoreBackend (  ) 

Definition at line 172 of file databasecorebackend.cpp.


Member Function Documentation

bool Digikam::DatabaseCoreBackend::beginTransaction (  ) 

Begin a database transaction.

Definition at line 490 of file databasecorebackend.cpp.

void Digikam::DatabaseCoreBackend::close (  ) 

Close the database connection.

Shall only be called from the thread that called open().

Definition at line 226 of file databasecorebackend.cpp.

bool Digikam::DatabaseCoreBackend::commitTransaction (  ) 

Commit the current database transaction.

Definition at line 507 of file databasecorebackend.cpp.

bool Digikam::DatabaseCoreBackend::exec ( QSqlQuery &  query  ) 

Calls exec/execBatch on the query, and handles debug output if something went wrong.

Definition at line 431 of file databasecorebackend.cpp.

bool Digikam::DatabaseCoreBackend::execBatch ( QSqlQuery &  query  ) 

Definition at line 465 of file databasecorebackend.cpp.

QSqlQuery Digikam::DatabaseCoreBackend::execQuery ( const QString &  sql,
const QList< QVariant > &  boundValues 
)

Definition at line 396 of file databasecorebackend.cpp.

QSqlQuery Digikam::DatabaseCoreBackend::execQuery ( const QString &  sql,
const QVariant &  boundValue1,
const QVariant &  boundValue2,
const QVariant &  boundValue3,
const QVariant &  boundValue4 
)

Definition at line 383 of file databasecorebackend.cpp.

QSqlQuery Digikam::DatabaseCoreBackend::execQuery ( const QString &  sql,
const QVariant &  boundValue1,
const QVariant &  boundValue2,
const QVariant &  boundValue3 
)

Definition at line 372 of file databasecorebackend.cpp.

QSqlQuery Digikam::DatabaseCoreBackend::execQuery ( const QString &  sql,
const QVariant &  boundValue1,
const QVariant &  boundValue2 
)

Definition at line 362 of file databasecorebackend.cpp.

QSqlQuery Digikam::DatabaseCoreBackend::execQuery ( const QString &  sql,
const QVariant &  boundValue1 
)

Definition at line 354 of file databasecorebackend.cpp.

QSqlQuery Digikam::DatabaseCoreBackend::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.

Definition at line 405 of file databasecorebackend.cpp.

bool Digikam::DatabaseCoreBackend::execSql ( const QString &  sql,
const QList< QVariant > &  boundValues,
QList< QVariant > *  values = 0,
QVariant *  lastInsertId = 0 
)

Definition at line 341 of file databasecorebackend.cpp.

bool Digikam::DatabaseCoreBackend::execSql ( const QString &  sql,
const QVariant &  boundValue1,
const QVariant &  boundValue2,
const QVariant &  boundValue3,
const QVariant &  boundValue4,
QList< QVariant > *  values = 0,
QVariant *  lastInsertId = 0 
)

Definition at line 326 of file databasecorebackend.cpp.

bool Digikam::DatabaseCoreBackend::execSql ( const QString &  sql,
const QVariant &  boundValue1,
const QVariant &  boundValue2,
const QVariant &  boundValue3,
QList< QVariant > *  values = 0,
QVariant *  lastInsertId = 0 
)

Definition at line 311 of file databasecorebackend.cpp.

bool Digikam::DatabaseCoreBackend::execSql ( const QString &  sql,
const QVariant &  boundValue1,
const QVariant &  boundValue2,
QList< QVariant > *  values = 0,
QVariant *  lastInsertId = 0 
)

Definition at line 297 of file databasecorebackend.cpp.

bool Digikam::DatabaseCoreBackend::execSql ( const QString &  sql,
const QVariant &  boundValue1,
QList< QVariant > *  values = 0,
QVariant *  lastInsertId = 0 
)

Definition at line 284 of file databasecorebackend.cpp.

bool Digikam::DatabaseCoreBackend::execSql ( const QString &  sql,
QList< QVariant > *  values = 0,
QVariant *  lastInsertId = 0 
)

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), sett lastInsertId to the address of a QVariant.

Definition at line 272 of file databasecorebackend.cpp.

bool Digikam::DatabaseCoreBackend::initSchema ( ThumbnailSchemaUpdater *  updater  ) 

Initialize the database schema to the current version, carry out upgrades if necessary.

Shall only be called from the thread that called open().

Definition at line 211 of file databasecorebackend.cpp.

bool Digikam::DatabaseCoreBackend::isCompatible ( const DatabaseParameters &  parameters  ) 

Checks if the parameters can be used for this database backend.

Definition at line 190 of file databasecorebackend.cpp.

bool Digikam::DatabaseCoreBackend::isInTransaction (  )  const

Returns if the database is in a different thread in a transaction.

Note that a transaction does not require holding DatabaseAccess. Note that this does not give information about other processes locking the database.

Definition at line 523 of file databasecorebackend.cpp.

bool Digikam::DatabaseCoreBackend::isOpen (  )  const [inline]

Definition at line 111 of file databasecorebackend.h.

bool Digikam::DatabaseCoreBackend::isReady (  )  const [inline]

Definition at line 112 of file databasecorebackend.h.

QString Digikam::DatabaseCoreBackend::lastError (  ) 

Returns a description of the last error that occurred on this database.

Use DatabaseAccess::lastError for errors presented to the user. This error will be included in that message. It may be empty.

Definition at line 542 of file databasecorebackend.cpp.

bool Digikam::DatabaseCoreBackend::open ( const DatabaseParameters &  parameters  ) 

Open the database connection.

Returns:
true on success

Definition at line 195 of file databasecorebackend.cpp.

QSqlQuery Digikam::DatabaseCoreBackend::prepareQuery ( const QString &  sql  ) 

Creates a query object prepared with the statement, waiting for bound values.

Definition at line 480 of file databasecorebackend.cpp.

QList< QVariant > Digikam::DatabaseCoreBackend::readToList ( QSqlQuery &  query  ) 

Definition at line 257 of file databasecorebackend.cpp.

void Digikam::DatabaseCoreBackend::rollbackTransaction (  ) 

Rollback the current database transaction.

Definition at line 529 of file databasecorebackend.cpp.

DatabaseCoreBackend::Status Digikam::DatabaseCoreBackend::status (  )  const

Returns the current status of the database backend.

Definition at line 233 of file databasecorebackend.cpp.

QStringList Digikam::DatabaseCoreBackend::tables (  ) 

Return a list with the names of the tables in the database.

Definition at line 536 of file databasecorebackend.cpp.


Member Data Documentation

DatabaseCoreBackendPrivate* const Digikam::DatabaseCoreBackend::d_ptr [protected]

Definition at line 227 of file databasecorebackend.h.


The documentation for this class was generated from the following files:
  • databasecorebackend.h
  • databasecorebackend.cpp

digikam

Skip menu "digikam"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  • digikam
Generated for API Reference by doxygen 1.5.9-20090814
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal