libopie PIM API Documentation

OContactAccessBackend_SQL Class Reference

This class is the SQL implementation of a Contact backend it does implement everything available for OContact. More...

#include <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 ()
 save the resource and all it's changes

bool load ()
 load the resource

void clear ()
 clear the back end

bool wasChangedExternally ()
 Return if database was changed externally.

QArray< intallRecords () const
 return an array of all available uids

OContact find (int uid) const
 find the OPimRecord with uid

QArray< intqueryByExample (const OContact &query, int settings, const QDateTime &d)
 queryByExample for T with the given Settings

QArray< intmatchRegexp (const QRegExp &r) const
 return a List of records that match the regex

const uint querySettings ()
 Return all possible settings.

bool hasQuerySettings (uint querySettings) const
 Check whether settings are correct.

QArray< intsorted (bool asc, int, int, int)
 FIXME!!! Returns a sorted list of records either ascendinf or descending for a giving criteria and category.

bool add (const OContact &newcontact)
 add T

bool replace (const OContact &contact)
 replace a record with T.uid()

bool remove (int uid)
 remove

bool reload ()
 reload the resource


Protected Attributes

bool m_changed
QString m_fileName
QArray< intm_uids
OSQLDriver * m_driver

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 49 of file ocontactaccessbackend_sql.h.


Constructor & Destructor Documentation

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

Definition at line 471 of file ocontactaccessbackend_sql.cpp.

References Global::applicationFileName(), QTime::elapsed(), load(), m_driver, m_fileName, and QTime::start().

OContactAccessBackend_SQL::~OContactAccessBackend_SQL  ) 
 

Definition at line 495 of file ocontactaccessbackend_sql.cpp.

References m_driver.


Member Function Documentation

bool OContactAccessBackend_SQL::save  )  [virtual]
 

save the resource and all it's changes

Implements OPimAccessBackend< OContact >.

Definition at line 523 of file ocontactaccessbackend_sql.cpp.

References m_driver.

bool OContactAccessBackend_SQL::load  )  [virtual]
 

load the resource

Implements OPimAccessBackend< OContact >.

Definition at line 501 of file ocontactaccessbackend_sql.cpp.

References m_driver.

Referenced by OContactAccessBackend_SQL(), and reload().

void OContactAccessBackend_SQL::clear  )  [virtual]
 

clear the back end

Implements OPimAccessBackend< OContact >.

Definition at line 529 of file ocontactaccessbackend_sql.cpp.

References m_driver, and reload().

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 537 of file ocontactaccessbackend_sql.cpp.

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

return an array of all available uids

Implements OPimAccessBackend< OContact >.

Definition at line 542 of file ocontactaccessbackend_sql.cpp.

References m_changed, and m_uids.

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 591 of file ocontactaccessbackend_sql.cpp.

References QTime::elapsed(), OPimRecord::setExtraMap(), and QTime::start().

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 606 of file ocontactaccessbackend_sql.cpp.

References QValueList::begin(), QValueList::end(), QString::isEmpty(), QString::latin1(), QString::left(), QString::length(), m_driver, QString::replace(), OContact::toMap(), OContactFields::untrfields(), and OContactFields::untrFieldsToId().

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

return a List of records that match the regex

Implements OContactAccessBackend.

Definition at line 655 of file ocontactaccessbackend_sql.cpp.

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 661 of file ocontactaccessbackend_sql.cpp.

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 667 of file ocontactaccessbackend_sql.cpp.

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 715 of file ocontactaccessbackend_sql.cpp.

References QTime::elapsed(), m_driver, and QTime::start().

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

add T

Implements OPimAccessBackend< OContact >.

Definition at line 553 of file ocontactaccessbackend_sql.cpp.

References QArray< int >::count(), m_driver, m_uids, QArray< int >::resize(), and Qtopia::Record::uid().

Referenced by replace().

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

replace a record with T.uid()

Implements OPimAccessBackend< OContact >.

Definition at line 582 of file ocontactaccessbackend_sql.cpp.

References add(), remove(), and Qtopia::Record::uid().

bool OContactAccessBackend_SQL::remove int  uid  )  [virtual]
 

remove

Implements OPimAccessBackend< OContact >.

Definition at line 569 of file ocontactaccessbackend_sql.cpp.

References m_changed, and m_driver.

Referenced by replace().

bool OContactAccessBackend_SQL::reload  )  [virtual]
 

reload the resource

Implements OPimAccessBackend< OContact >.

Definition at line 518 of file ocontactaccessbackend_sql.cpp.

References load().

Referenced by clear().


Member Data Documentation

bool OContactAccessBackend_SQL::m_changed [protected]
 

Definition at line 94 of file ocontactaccessbackend_sql.h.

Referenced by allRecords(), and remove().

QString OContactAccessBackend_SQL::m_fileName [protected]
 

Definition at line 95 of file ocontactaccessbackend_sql.h.

Referenced by OContactAccessBackend_SQL().

QArray<int> OContactAccessBackend_SQL::m_uids [protected]
 

Definition at line 96 of file ocontactaccessbackend_sql.h.

Referenced by add(), and allRecords().

OSQLDriver* OContactAccessBackend_SQL::m_driver [protected]
 

Definition at line 98 of file ocontactaccessbackend_sql.h.

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


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for OPIE Version 1.1.
Documentation copyright © 1997-2003 the KDE developers. 2003 OPIE developers
Generated on Tue Feb 10 20:26:09 2004 by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2001