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

digikam

Digikam::DatabaseAccess

Digikam::DatabaseAccess Class Reference

#include <databaseaccess.h>

List of all members.

Public Types

enum  ApplicationStatus { MainApplication, DatabaseSlave }

Public Member Functions

 DatabaseAccess ()
 ~DatabaseAccess ()
DatabaseBackend * backend () const
AlbumDB * db () const
ImageInfoCache * imageInfoCache () const
QString lastError ()
void setLastError (const QString &error)

Static Public Member Functions

static bool checkReadyForUse (InitializationObserver *observer=0)
static void cleanUpDatabase ()
static DatabaseWatch * databaseWatch ()
static DatabaseParameters parameters ()
static void setParameters (const DatabaseParameters &parameters, ApplicationStatus status)
static void setParameters (const DatabaseParameters &parameters)

Detailed Description

Definition at line 44 of file databaseaccess.h.


Member Enumeration Documentation

enum Digikam::DatabaseAccess::ApplicationStatus
Enumerator:
MainApplication 
DatabaseSlave 

Definition at line 92 of file databaseaccess.h.


Constructor & Destructor Documentation

Digikam::DatabaseAccess::DatabaseAccess (  ) 

The DatabaseAccess provides access to the database: Create an instance of this class on the stack to retrieve a pointer to the database.

While you hold an instance of DatabaseAccess, the database access is locked for other threads, but _not_ for other processes. This is due to the fact that while databases allow concurrent access (of course), their client libs may not be thread-safe.

When initializing your application, you need to call two methods:

  • in a not-yet-multithreaded context, you need to call setParameters
  • to make sure that the database is available and the schema is properly initialized, call checkReadyForUse() Create a DatabaseAccess object for the default database. Note that when initializing your app, setParameters need to be called (in a not-yet-multithreaded context) for this to work. If the database is not yet opened, it will be opened. The schema will not be checked, use checkReadyForUse() for a full opening process including schema update and error messages.

Definition at line 97 of file databaseaccess.cpp.

Digikam::DatabaseAccess::~DatabaseAccess (  ) 

Definition at line 115 of file databaseaccess.cpp.


Member Function Documentation

DatabaseBackend * Digikam::DatabaseAccess::backend (  )  const

Retrieve a pointer to the database backend.

Definition at line 134 of file databaseaccess.cpp.

bool Digikam::DatabaseAccess::checkReadyForUse ( InitializationObserver *  observer = 0  )  [static]

Method to one-time initialize a database when new parameters have been set: Make sure that the database is open, that the schema has properly been initialized.

If the parameters were not changed, this method has no effect.

Returns:
if the database is ready for use

Definition at line 208 of file databaseaccess.cpp.

void Digikam::DatabaseAccess::cleanUpDatabase (  )  [static]

Clean up the database access.

When this function has been called, the access can be restored by calling setParameters. Construction a database access object otherwise after calling this method will crash.

Definition at line 273 of file databaseaccess.cpp.

DatabaseWatch * Digikam::DatabaseAccess::databaseWatch (  )  [static]

Return the DatabaseWatch.

Definition at line 144 of file databaseaccess.cpp.

AlbumDB * Digikam::DatabaseAccess::db (  )  const

Retrieve a pointer to the album database.

Definition at line 129 of file databaseaccess.cpp.

ImageInfoCache * Digikam::DatabaseAccess::imageInfoCache (  )  const

Return the ImageInfoCache.

This object is not for public use outside libs/database/

Definition at line 139 of file databaseaccess.cpp.

QString Digikam::DatabaseAccess::lastError (  ) 

Returns the error message for the last error that occurred, or a null QString of no error occurred.

Definition at line 263 of file databaseaccess.cpp.

DatabaseParameters Digikam::DatabaseAccess::parameters (  )  [static]

Return the default parameters.

Definition at line 151 of file databaseaccess.cpp.

void Digikam::DatabaseAccess::setLastError ( const QString &  error  ) 

Set the "last error" message.

This method is not for public use.

Definition at line 268 of file databaseaccess.cpp.

void Digikam::DatabaseAccess::setParameters ( const DatabaseParameters &  parameters,
ApplicationStatus  status 
) [static]

Definition at line 166 of file databaseaccess.cpp.

void Digikam::DatabaseAccess::setParameters ( const DatabaseParameters &  parameters  )  [static]

Set the default parameters.

Call this function at least once in the starting phase of your application, when no other threads will yet access the database, to initialize DatabaseAcccess. After this initial call, it is thread-safe to call this function again. In a subsequent call, if the parameters are identical, nothing is done. If the parameters change, the current database will be closed. When parameters have been set or changed, the new one will be opened on-demand, i.e. when the first DatabaseAccess object is constructed.

Definition at line 158 of file databaseaccess.cpp.


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

digikam

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

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