Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

Opie::OPimContactAccessBackend_SQL Class Reference

#include </home/clem/local/src/opie/libopie2/opiepim/backend/ocontactaccessbackend_sql.h>

Inheritance diagram for Opie::OPimContactAccessBackend_SQL:

Inheritance graph
[legend]
Collaboration diagram for Opie::OPimContactAccessBackend_SQL:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 OPimContactAccessBackend_SQL (const QString &appname, const QString &filename=QString::null)
 ~OPimContactAccessBackend_SQL ()
bool save ()
bool load ()
void clear ()
bool wasChangedExternally ()
UIDArray allRecords () const
OPimContact find (int uid) const
OPimContact find (int uid, const UIDArray &items, uint cur, Frontend::CacheDirection) const
UIDArray queryByExample (const UIDArray &uidlist, const OPimContact &query, int settings, const QDateTime &d) const
UIDArray matchRegexp (const QRegExp &r) const
const uint querySettings () const
bool hasQuerySettings (uint querySettings) const
UIDArray sorted (const UIDArray &ar, bool asc, int sortOrder, int filter, const QArray< int > &categories) const
bool add (const OPimContact &newcontact)
bool replace (const OPimContact &contact)
bool remove (int uid)
bool reload ()

Protected Attributes

bool m_changed
QString m_fileName
UIDArray m_uids
Opie::DB::OSQLDriverm_driver

Private Member Functions

UIDArray extractUids (Opie::DB::OSQLResult &res) const
QMap< int, QStringrequestNonCustom (int uid) const
QMap< QString, QStringrequestCustom (int uid) const
QMap< int, QStringfillNonCustomMap (const Opie::DB::OSQLResultItem &resultItem) const
OPimContact requestContactsAndCache (int uid, const QArray< int > &cachelist) const
void update ()

Detailed Description

This class is the SQL implementation of a Contact backend it does implement everything available for OPimContact.
See also:
OPimAccessBackend for more information of available methods

Definition at line 59 of file ocontactaccessbackend_sql.h.


Constructor & Destructor Documentation

Opie::OPimContactAccessBackend_SQL::OPimContactAccessBackend_SQL const QString appname,
const QString filename = QString::null
 

Definition at line 356 of file ocontactaccessbackend_sql.cpp.

References Global::applicationFileName(), QTime::elapsed(), QString::isEmpty(), load(), m_driver, m_fileName, odebug, oendl, Opie::DB::OSQLDriver::setUrl(), Opie::DB::OSQLManager::standard(), QTime::start(), and t.

Opie::OPimContactAccessBackend_SQL::~OPimContactAccessBackend_SQL  ) 
 

Definition at line 380 of file ocontactaccessbackend_sql.cpp.

References m_driver.


Member Function Documentation

bool Opie::OPimContactAccessBackend_SQL::add const OPimContact newcontact  )  [virtual]
 

Implements Opie::OPimAccessBackend< OPimContact >.

Definition at line 438 of file ocontactaccessbackend_sql.cpp.

References m_driver, m_uids, odebug, oendl, Opie::DB::OSQLDriver::query(), and Opie::DB::OSQLResult::state().

Referenced by replace().

UIDArray Opie::OPimContactAccessBackend_SQL::allRecords  )  const [virtual]
 

Implements Opie::OPimAccessBackend< OPimContact >.

Definition at line 427 of file ocontactaccessbackend_sql.cpp.

References m_changed, and m_uids.

void Opie::OPimContactAccessBackend_SQL::clear  )  [virtual]
 

Implements Opie::OPimAccessBackend< OPimContact >.

Definition at line 414 of file ocontactaccessbackend_sql.cpp.

References m_driver, Opie::DB::OSQLDriver::query(), and reload().

UIDArray Opie::OPimContactAccessBackend_SQL::extractUids Opie::DB::OSQLResult res  )  const [private]
 

Referenced by matchRegexp(), queryByExample(), sorted(), and update().

QMap<int, QString> Opie::OPimContactAccessBackend_SQL::fillNonCustomMap const Opie::DB::OSQLResultItem resultItem  )  const [private]
 

Referenced by requestNonCustom().

OPimContact Opie::OPimContactAccessBackend_SQL::find int  uid,
const UIDArray items,
uint  cur,
Frontend::CacheDirection 
const
 

Definition at line 490 of file ocontactaccessbackend_sql.cpp.

References QTime::elapsed(), i, odebug, oendl, Opie::OPimAccessBackend< OPimContact >::readAhead(), requestContactsAndCache(), size, QTime::start(), and t.

OPimContact Opie::OPimContactAccessBackend_SQL::find int  uid  )  const
 

Definition at line 477 of file ocontactaccessbackend_sql.cpp.

References QTime::elapsed(), odebug, oendl, requestCustom(), requestNonCustom(), Opie::OPimRecord::setExtraMap(), QTime::start(), and t.

bool Opie::OPimContactAccessBackend_SQL::hasQuerySettings uint  querySettings  )  const [virtual]
 

Check whether settings are correct.

Returns:
true if the given settings are correct and possible.

Reimplemented from Opie::OPimContactAccessBackend.

Definition at line 730 of file ocontactaccessbackend_sql.cpp.

References Opie::OPimBase::DateDay, Opie::OPimBase::DateDiff, Opie::OPimBase::DateMonth, Opie::OPimBase::DateYear, Opie::OPimBase::ExactMatch, Opie::OPimBase::IgnoreCase, Opie::OPimBase::RegExp, and Opie::OPimBase::WildCards.

bool Opie::OPimContactAccessBackend_SQL::load  )  [virtual]
 

Implements Opie::OPimAccessBackend< OPimContact >.

Definition at line 386 of file ocontactaccessbackend_sql.cpp.

References m_driver, Opie::DB::OSQLDriver::open(), Opie::DB::OSQLDriver::query(), and update().

Referenced by OPimContactAccessBackend_SQL(), and reload().

UIDArray Opie::OPimContactAccessBackend_SQL::matchRegexp const QRegExp r  )  const [virtual]
 

Reimplemented from Opie::OPimAccessBackend< OPimContact >.

Definition at line 688 of file ocontactaccessbackend_sql.cpp.

References QValueList< T >::begin(), QValueList< T >::end(), extractUids(), QString::isEmpty(), m_driver, odebug, oendl, QRegExp::pattern(), Opie::DB::OSQLDriver::query(), and Opie::OPimContactFields::untrfields().

UIDArray Opie::OPimContactAccessBackend_SQL::queryByExample const UIDArray uidlist,
const OPimContact query,
int  settings,
const QDateTime d
const [virtual]
 

Advanced search mechanism.

Reimplemented from Opie::OPimContactAccessBackend.

Definition at line 533 of file ocontactaccessbackend_sql.cpp.

References Opie::OPimContact::anniversary(), Qtopia::Anniversary, QValueList< T >::begin(), Opie::OPimContact::birthday(), Qtopia::Birthday, QDate::currentDate(), QDateTime::date(), Opie::OPimBase::DateDay, Opie::OPimBase::DateDiff, Opie::OPimBase::DateMonth, Opie::OPimBase::DateYear, QDate::day(), empty, QValueList< T >::end(), extractUids(), QString::findRev(), i, Opie::OPimBase::IgnoreCase, QString::isEmpty(), QDateTime::isValid(), l, QString::length(), list, m_driver, m_uids, QDate::month(), QString::number(), odebug, oendl, Opie::DB::OSQLDriver::query(), QString::remove(), QString::replace(), QString::rightJustify(), Opie::DB::OSQLResult::state(), Opie::OPimContact::toMap(), Opie::OPimContactFields::untrfields(), Opie::OPimContactFields::untrFieldsToId(), and QDate::year().

const uint Opie::OPimContactAccessBackend_SQL::querySettings  )  const [virtual]
 

Return all possible settings.

Returns:
All settings provided by the current backend (i.e.: query_WildCards & query_IgnoreCase)

Reimplemented from Opie::OPimContactAccessBackend.

Definition at line 719 of file ocontactaccessbackend_sql.cpp.

References Opie::OPimBase::DateDay, Opie::OPimBase::DateDiff, Opie::OPimBase::DateMonth, Opie::OPimBase::DateYear, Opie::OPimBase::IgnoreCase, and Opie::OPimBase::WildCards.

bool Opie::OPimContactAccessBackend_SQL::reload  )  [virtual]
 

Implements Opie::OPimAccessBackend< OPimContact >.

Definition at line 403 of file ocontactaccessbackend_sql.cpp.

References load().

Referenced by clear().

bool Opie::OPimContactAccessBackend_SQL::remove int  uid  ) 
 

Definition at line 455 of file ocontactaccessbackend_sql.cpp.

References m_changed, m_driver, Opie::DB::OSQLDriver::query(), rem, and Opie::DB::OSQLResult::state().

Referenced by replace().

bool Opie::OPimContactAccessBackend_SQL::replace const OPimContact contact  )  [virtual]
 

Implements Opie::OPimAccessBackend< OPimContact >.

Definition at line 468 of file ocontactaccessbackend_sql.cpp.

References add(), and remove().

OPimContact Opie::OPimContactAccessBackend_SQL::requestContactsAndCache int  uid,
const QArray< int > &  cachelist
const [private]
 

Referenced by find().

QMap< QString, QString > Opie::OPimContactAccessBackend_SQL::requestCustom int  uid  )  const [private]
 

Definition at line 1067 of file ocontactaccessbackend_sql.cpp.

References QValueList< T >::begin(), QTime::elapsed(), empty, QValueList< T >::end(), QMap< Key, T >::insert(), m_driver, odebug, owarn, Opie::DB::OSQLDriver::query(), Opie::DB::OSQLResult::results(), QTime::start(), and Opie::DB::OSQLResult::state().

Referenced by find().

QMap< int, QString > Opie::OPimContactAccessBackend_SQL::requestNonCustom int  uid  )  const [private]
 

Definition at line 948 of file ocontactaccessbackend_sql.cpp.

References QTime::elapsed(), fillNonCustomMap(), Opie::DB::OSQLResult::first(), m_driver, odebug, Opie::DB::OSQLDriver::query(), and QTime::start().

Referenced by find().

bool Opie::OPimContactAccessBackend_SQL::save  )  [virtual]
 

Implements Opie::OPimAccessBackend< OPimContact >.

Definition at line 408 of file ocontactaccessbackend_sql.cpp.

References Opie::DB::OSQLDriver::close(), and m_driver.

UIDArray Opie::OPimContactAccessBackend_SQL::sorted const UIDArray ar,
bool  asc,
int  sortOrder,
int  filter,
const QArray< int > &  categories
const [virtual]
 

Slow and inefficent default implementation

Reimplemented from Opie::OPimContactAccessBackend.

Definition at line 778 of file ocontactaccessbackend_sql.cpp.

References Opie::OPimContactAccess::DoNotShowWithCategory, Opie::OPimContactAccess::DoNotShowWithoutAnniversary, Opie::OPimContactAccess::DoNotShowWithoutBirthday, Opie::OPimContactAccess::DoNotShowWithoutBusinessAddress, Opie::OPimContactAccess::DoNotShowWithoutChildren, Opie::OPimContactAccess::DoNotShowWithoutHomeAddress, QTime::elapsed(), empty, extractUids(), Opie::OPimBase::FilterCategory, Opie::OPimBase::FilterOff, i, QString::length(), list, m_driver, QString::number(), odebug, oendl, Opie::DB::OSQLDriver::query(), QString::remove(), Opie::OPimContactAccess::SortAnniversary, Opie::OPimContactAccess::SortAnniversaryWithoutYear, Opie::OPimContactAccess::SortBirthday, Opie::OPimContactAccess::SortBirthdayWithoutYear, Opie::OPimBase::SortByCategory, Opie::OPimBase::SortByDate, Opie::OPimContactAccess::SortEmail, Opie::OPimContactAccess::SortFileAsName, Opie::OPimContactAccess::SortFirstName, Opie::OPimContactAccess::SortGender, Opie::OPimContactAccess::SortLastName, Opie::OPimContactAccess::SortMiddleName, Opie::OPimContactAccess::SortNickname, Opie::OPimContactAccess::SortSuffix, Opie::OPimBase::SortSummary, Opie::OPimContactAccess::SortTitle, QTime::start(), Opie::DB::OSQLResult::state(), and t.

void Opie::OPimContactAccessBackend_SQL::update  )  [private]
 

Definition at line 906 of file ocontactaccessbackend_sql.cpp.

References QTime::elapsed(), extractUids(), m_changed, m_driver, m_uids, odebug, oendl, Opie::DB::OSQLDriver::query(), QTime::start(), Opie::DB::OSQLResult::state(), and t.

Referenced by load().

bool Opie::OPimContactAccessBackend_SQL::wasChangedExternally  )  [virtual]
 

Return if database was changed externally. This may just make sense on file based databases like a XML-File. It is used to prevent to overwrite the current database content if the file was already changed by something else ! If this happens, we have to reload before save our data. If we use real databases, this should be handled by the database management system themselve, therefore this function should always return false in this case. It is not our problem to handle this conflict ...

Returns:
true if the database was changed and if save without reload will be dangerous. false if the database was not changed or it is save to write in this situation.

Implements Opie::OPimContactAccessBackend.

Definition at line 422 of file ocontactaccessbackend_sql.cpp.


Member Data Documentation

bool Opie::OPimContactAccessBackend_SQL::m_changed [protected]
 

Definition at line 106 of file ocontactaccessbackend_sql.h.

Referenced by allRecords(), remove(), and update().

Opie::DB::OSQLDriver* Opie::OPimContactAccessBackend_SQL::m_driver [protected]
 

Definition at line 110 of file ocontactaccessbackend_sql.h.

Referenced by add(), clear(), load(), matchRegexp(), OPimContactAccessBackend_SQL(), queryByExample(), remove(), requestCustom(), requestNonCustom(), save(), sorted(), update(), and ~OPimContactAccessBackend_SQL().

QString Opie::OPimContactAccessBackend_SQL::m_fileName [protected]
 

Definition at line 107 of file ocontactaccessbackend_sql.h.

Referenced by OPimContactAccessBackend_SQL().

UIDArray Opie::OPimContactAccessBackend_SQL::m_uids [protected]
 

Definition at line 108 of file ocontactaccessbackend_sql.h.

Referenced by add(), allRecords(), queryByExample(), and update().


The documentation for this class was generated from the following files:
Generated on Sat Nov 5 17:59:16 2005 for OPIE by  doxygen 1.4.2