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

OContactAccessBackend_SQL Class Reference

#include </home/clem/local/src/opie/noncore/unsupported/libopie/pim/ocontactaccessbackend_sql.h>

Inheritance diagram for OContactAccessBackend_SQL:

Inheritance graph
[legend]
Collaboration diagram for OContactAccessBackend_SQL:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 OContactAccessBackend_SQL (const QString &appname, const QString &filename=QString::null)
 ~OContactAccessBackend_SQL ()
bool save ()
bool load ()
void clear ()
bool wasChangedExternally ()
QArray< int > allRecords () const
OContact find (int uid) const
QArray< int > queryByExample (const OContact &query, int settings, const QDateTime &d)
QArray< int > matchRegexp (const QRegExp &r) const
const uint querySettings ()
bool hasQuerySettings (uint querySettings) const
QArray< int > sorted (bool asc, int, int, int)
bool add (const OContact &newcontact)
bool replace (const OContact &contact)
bool remove (int uid)
bool reload ()

Protected Attributes

bool m_changed
QString m_fileName
QArray< int > m_uids
Opie::DB::OSQLDriverm_driver

Private Member Functions

QArray< int > extractUids (Opie::DB::OSQLResult &res) const
QMap< int, QStringrequestNonCustom (int uid) const
QMap< QString, QStringrequestCustom (int uid) const
void update ()

Detailed Description

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

Definition at line 58 of file ocontactaccessbackend_sql.h.


Constructor & Destructor Documentation

OContactAccessBackend_SQL::OContactAccessBackend_SQL const QString appname,
const QString filename = QString::null
 

Definition at line 477 of file ocontactaccessbackend_sql.cpp.

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

OContactAccessBackend_SQL::~OContactAccessBackend_SQL  ) 
 

Definition at line 501 of file ocontactaccessbackend_sql.cpp.

References m_driver.


Member Function Documentation

bool OContactAccessBackend_SQL::add const OContact newcontact  )  [virtual]
 

add T

Implements OPimAccessBackend< OContact >.

Definition at line 559 of file ocontactaccessbackend_sql.cpp.

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

Referenced by replace().

QArray< int > OContactAccessBackend_SQL::allRecords  )  const [virtual]
 

return an array of all available uids

Implements OPimAccessBackend< OContact >.

Definition at line 548 of file ocontactaccessbackend_sql.cpp.

References m_changed, and m_uids.

void OContactAccessBackend_SQL::clear  )  [virtual]
 

clear the back end

Implements OPimAccessBackend< OContact >.

Definition at line 535 of file ocontactaccessbackend_sql.cpp.

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

QArray< int > OContactAccessBackend_SQL::extractUids Opie::DB::OSQLResult res  )  const [private]
 

Definition at line 774 of file ocontactaccessbackend_sql.cpp.

References QValueList< T >::begin(), QValueList< T >::count(), QTime::elapsed(), QValueList< T >::end(), i, list, qWarning(), Opie::DB::OSQLResult::results(), QTime::start(), and t.

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

OContact OContactAccessBackend_SQL::find int  uid  )  const [virtual]
 

find the OPimRecord with uid

Parameters:
uid returns T and T.isEmpty() if nothing was found

Implements OPimAccessBackend< OContact >.

Definition at line 597 of file ocontactaccessbackend_sql.cpp.

References QTime::elapsed(), qWarning(), requestCustom(), requestNonCustom(), OPimRecord::setExtraMap(), QTime::start(), and t.

bool OContactAccessBackend_SQL::hasQuerySettings uint  querySettings  )  const [virtual]
 

Check whether settings are correct.

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

Implements OContactAccessBackend.

Definition at line 673 of file ocontactaccessbackend_sql.cpp.

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

bool OContactAccessBackend_SQL::load  )  [virtual]
 

load the resource

Implements OPimAccessBackend< OContact >.

Definition at line 507 of file ocontactaccessbackend_sql.cpp.

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

Referenced by OContactAccessBackend_SQL(), and reload().

QArray< int > OContactAccessBackend_SQL::matchRegexp const QRegExp r  )  const [virtual]
 

return a List of records that match the regex

Implements OContactAccessBackend.

Definition at line 661 of file ocontactaccessbackend_sql.cpp.

QArray< int > OContactAccessBackend_SQL::queryByExample const OContact query,
int  settings,
const QDateTime d = QDateTime()
[virtual]
 

queryByExample for T with the given Settings

Implements OPimAccessBackend< OContact >.

Definition at line 612 of file ocontactaccessbackend_sql.cpp.

References QValueList< T >::begin(), empty, QValueList< T >::end(), extractUids(), OContactAccess::IgnoreCase, QString::isEmpty(), QString::latin1(), QString::left(), QString::length(), list, m_driver, Opie::DB::OSQLDriver::query(), qWarning(), QString::replace(), Opie::DB::OSQLResult::state(), OContact::toMap(), OContactFields::untrfields(), and OContactFields::untrFieldsToId().

const uint OContactAccessBackend_SQL::querySettings  )  [virtual]
 

Return all possible settings.

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

Implements OContactAccessBackend.

Definition at line 667 of file ocontactaccessbackend_sql.cpp.

References OContactAccess::IgnoreCase, and OContactAccess::WildCards.

bool OContactAccessBackend_SQL::reload  )  [virtual]
 

reload the resource

Implements OPimAccessBackend< OContact >.

Definition at line 524 of file ocontactaccessbackend_sql.cpp.

References load().

Referenced by clear().

bool OContactAccessBackend_SQL::remove int  uid  )  [virtual]
 

remove

Implements OPimAccessBackend< OContact >.

Definition at line 575 of file ocontactaccessbackend_sql.cpp.

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

Referenced by replace().

bool OContactAccessBackend_SQL::replace const OContact contact  )  [virtual]
 

replace a record with T.uid()

Implements OPimAccessBackend< OContact >.

Definition at line 588 of file ocontactaccessbackend_sql.cpp.

References add(), and remove().

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

Definition at line 924 of file ocontactaccessbackend_sql.cpp.

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

Referenced by find().

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

Definition at line 796 of file ocontactaccessbackend_sql.cpp.

References Qtopia::AddressCategory, Qtopia::AddressUid, Qtopia::Anniversary, QValueList< T >::begin(), Qtopia::Birthday, Opie::DB::OSQLResultItem::data(), OConversion::dateToString(), QTime::elapsed(), QValueList< T >::end(), Opie::DB::OSQLResult::first(), QMap< Key, T >::insert(), QString::latin1(), list, m_driver, Opie::DB::OSQLDriver::query(), qWarning(), QStringList::split(), QTime::start(), t, OContactFields::untrfields(), and OContactFields::untrFieldsToId().

Referenced by find().

bool OContactAccessBackend_SQL::save  )  [virtual]
 

save the resource and all it's changes

Implements OPimAccessBackend< OContact >.

Definition at line 529 of file ocontactaccessbackend_sql.cpp.

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

QArray< int > OContactAccessBackend_SQL::sorted bool  asc,
int  ,
int  ,
int 
[virtual]
 

FIXME!!! Returns a sorted list of records either ascendinf or descending for a giving criteria and category

Implements OContactAccessBackend.

Definition at line 721 of file ocontactaccessbackend_sql.cpp.

References QTime::elapsed(), empty, extractUids(), list, m_driver, Opie::DB::OSQLDriver::query(), qWarning(), QTime::start(), Opie::DB::OSQLResult::state(), and t.

void OContactAccessBackend_SQL::update  )  [private]
 

Definition at line 753 of file ocontactaccessbackend_sql.cpp.

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

Referenced by load().

bool OContactAccessBackend_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 OContactAccessBackend.

Definition at line 543 of file ocontactaccessbackend_sql.cpp.


Member Data Documentation

bool OContactAccessBackend_SQL::m_changed [protected]
 

Definition at line 103 of file ocontactaccessbackend_sql.h.

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

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

Definition at line 107 of file ocontactaccessbackend_sql.h.

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

QString OContactAccessBackend_SQL::m_fileName [protected]
 

Definition at line 104 of file ocontactaccessbackend_sql.h.

Referenced by OContactAccessBackend_SQL().

QArray<int> OContactAccessBackend_SQL::m_uids [protected]
 

Definition at line 105 of file ocontactaccessbackend_sql.h.

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


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