The Contact Database is a database of Contact Items. The main API to the Contact Database is provided by the CContactDatabase
class. The CContactDatabase
class allows clients to create (CContactDatabase::CreateL()
) a new Contact Database, or open (CContactDatabase::OpenL()
) an existing one.
Once opened, the database can be searched and sorted, and items within it can be edited or read, new items can be added and existing ones can be deleted (CContactDatabase::doDeleteContactL()
). To edit an item, it must first be opened. Changes to the item can then be committed to storage using CContactDatabase::CommitContactL()
. Only open items can be committed.
Client applications that need to be updated dynamically, as the database is altered by other clients, should derive from class MContactDbObserver
. The observer's MContactDbObserver::HandleDatabaseEventL()
function will be called in response to each change to the database.
When contacts are modified the database can become fragmented, limiting the amount of space available. This leads to less efficient storage. To determine whether defragmentation is required for the database use CContactDatabase::CompressRequired()
.This function provides an easy way of testing whether the database is being used efficiently. ETrue is returned if a compression of the database is recommended. To compress the database to its minimum size use CContactDatabase::CompactL()
.
CContactDatabase::IsDamaged()
tests to see whether the database is corrupted and needs to be recovered. If the database is corrupted it can be recovered through a rollback. CContactDatabase::RecoverL()
first closes all tables in the database and then reopens them after the database is repaired. CContactDatabase::DatabaseRollback()
will force a rollback of the database.