-rw-r--r-- | libopie/pim/ocontactaccessbackend_sql.cpp | 5 | ||||
-rw-r--r-- | libopie/pim/ocontactaccessbackend_sql.h | 10 | ||||
-rw-r--r-- | libopie/pim/odatebookaccessbackend_sql.cpp | 4 | ||||
-rw-r--r-- | libopie/pim/odatebookaccessbackend_sql.h | 7 | ||||
-rw-r--r-- | libopie/pim/otodoaccesssql.cpp | 1 | ||||
-rw-r--r-- | libopie/pim/otodoaccesssql.h | 13 |
6 files changed, 31 insertions, 9 deletions
diff --git a/libopie/pim/ocontactaccessbackend_sql.cpp b/libopie/pim/ocontactaccessbackend_sql.cpp index a5be4c8..d20df56 100644 --- a/libopie/pim/ocontactaccessbackend_sql.cpp +++ b/libopie/pim/ocontactaccessbackend_sql.cpp @@ -5,24 +5,27 @@ * * ===================================================================== * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * ===================================================================== * ===================================================================== * Version: $Id$ * ===================================================================== * History: * $Log$ + * Revision 1.5 2004/03/14 13:50:35 alwin + * namespace correction + * * Revision 1.4 2003/12/22 10:19:26 eilers * Finishing implementation of sql-backend for datebook. But I have to * port the PIM datebook application to use it, before I could debug the * whole stuff. * Thus, PIM-Database backend is finished, but highly experimental. And some * parts are still generic. For instance, the "queryByExample()" methods are * not (or not fully) implemented. Todo: custom-entries not stored. * The big show stopper: matchRegExp() (needed by OpieSearch) needs regular * expression search in the database, which is not supported by sqlite ! * Therefore we need either an extended sqlite or a workaround which would * be very slow and memory consuming.. * @@ -48,25 +51,25 @@ #include <qstringlist.h> #include <qpe/global.h> #include <qpe/recordfields.h> #include <opie/ocontactfields.h> #include <opie/oconversion.h> #include <opie2/osqldriver.h> #include <opie2/osqlresult.h> #include <opie2/osqlmanager.h> #include <opie2/osqlquery.h> - +using namespace Opie::DB; // If defined, we use a horizontal table ( uid, attr1, attr2, attr3, ..., attrn ) instead // vertical like "uid, type, value". // DON'T DEACTIVATE THIS DEFINE IN PRODUCTIVE ENVIRONMENTS !! #define __STORE_HORIZONTAL_ // Distinct loading is not very fast. If I expect that every person has just // one (and always one) 'Last Name', I can request all uid's for existing lastnames, // which is faster.. // But this may not be true for all entries, like company contacts.. // The current AddressBook application handles this problem, but other may not.. (eilers) diff --git a/libopie/pim/ocontactaccessbackend_sql.h b/libopie/pim/ocontactaccessbackend_sql.h index b8f1d8d..f553760 100644 --- a/libopie/pim/ocontactaccessbackend_sql.h +++ b/libopie/pim/ocontactaccessbackend_sql.h @@ -7,48 +7,54 @@ * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * ===================================================================== * * * ===================================================================== * Version: $Id$ * ===================================================================== * History: * $Log$ + * Revision 1.3 2004/03/14 13:50:35 alwin + * namespace correction + * * Revision 1.2 2003/12/08 15:18:11 eilers * Committing unfinished sql implementation before merging to libopie2 starts.. * * Revision 1.1 2003/09/22 14:31:16 eilers * Added first experimental incarnation of sql-backend for addressbook. * Some modifications to be able to compile the todo sql-backend. * A lot of changes fill follow... * * */ #ifndef _OContactAccessBackend_SQL_ #define _OContactAccessBackend_SQL_ #include "ocontactaccessbackend.h" #include "ocontactaccess.h" #include <qlist.h> #include <qdict.h> +namespace Opie { namespace DB { class OSQLDriver; class OSQLResult; class OSQLResultItem; +}} + /* the default xml implementation */ /** * This class is the SQL implementation of a Contact backend * it does implement everything available for OContact. * @see OPimAccessBackend for more information of available methods */ class OContactAccessBackend_SQL : public OContactAccessBackend { public: OContactAccessBackend_SQL ( const QString& appname, const QString& filename = QString::null ); ~OContactAccessBackend_SQL (); @@ -76,26 +82,26 @@ class OContactAccessBackend_SQL : public OContactAccessBackend { bool hasQuerySettings (uint querySettings) const; // Currently only asc implemented.. QArray<int> sorted( bool asc, int , int , int ); bool add ( const OContact &newcontact ); bool replace ( const OContact &contact ); bool remove ( int uid ); bool reload(); private: - QArray<int> extractUids( OSQLResult& res ) const; + QArray<int> extractUids( Opie::DB::OSQLResult& res ) const; QMap<int, QString> requestNonCustom( int uid ) const; QMap<QString, QString> requestCustom( int uid ) const; void update(); protected: bool m_changed; QString m_fileName; QArray<int> m_uids; - OSQLDriver* m_driver; + Opie::DB::OSQLDriver* m_driver; }; #endif diff --git a/libopie/pim/odatebookaccessbackend_sql.cpp b/libopie/pim/odatebookaccessbackend_sql.cpp index 756f405..44dd2bc 100644 --- a/libopie/pim/odatebookaccessbackend_sql.cpp +++ b/libopie/pim/odatebookaccessbackend_sql.cpp @@ -5,24 +5,27 @@ * * ===================================================================== * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * ===================================================================== * ===================================================================== * Version: $Id$ * ===================================================================== * History: * $Log$ + * Revision 1.4 2004/03/14 13:50:35 alwin + * namespace correction + * * Revision 1.3 2003/12/22 11:41:39 eilers * Fixing stupid bug, found by sourcode review.. * * Revision 1.2 2003/12/22 10:19:26 eilers * Finishing implementation of sql-backend for datebook. But I have to * port the PIM datebook application to use it, before I could debug the * whole stuff. * Thus, PIM-Database backend is finished, but highly experimental. And some * parts are still generic. For instance, the "queryByExample()" methods are * not (or not fully) implemented. Todo: custom-entries not stored. * The big show stopper: matchRegExp() (needed by OpieSearch) needs regular * expression search in the database, which is not supported by sqlite ! @@ -41,24 +44,25 @@ #include <qarray.h> #include <qstringlist.h> #include <qpe/global.h> #include <opie2/osqldriver.h> #include <opie2/osqlmanager.h> #include <opie2/osqlquery.h> #include "orecur.h" #include "odatebookaccessbackend_sql.h" +using namespace Opie::DB; ODateBookAccessBackend_SQL::ODateBookAccessBackend_SQL( const QString& , const QString& fileName ) : ODateBookAccessBackend(), m_driver( NULL ) { m_fileName = fileName.isEmpty() ? Global::applicationFileName( "datebook", "datebook.db" ) : fileName; // Get the standart sql-driver from the OSQLManager.. OSQLManager man; m_driver = man.standard(); m_driver->setUrl( m_fileName ); diff --git a/libopie/pim/odatebookaccessbackend_sql.h b/libopie/pim/odatebookaccessbackend_sql.h index f39e154..ba514bc 100644 --- a/libopie/pim/odatebookaccessbackend_sql.h +++ b/libopie/pim/odatebookaccessbackend_sql.h @@ -1,22 +1,25 @@ #ifndef OPIE_DATE_BOOK_ACCESS_BACKEND_SQL__H #define OPIE_DATE_BOOK_ACCESS_BACKEND_SQL__H #include <qmap.h> #include <opie2/osqlresult.h> #include "odatebookaccessbackend.h" +namespace Opie { namespace DB { class OSQLDriver; +}} + /** * This is the default SQL implementation for DateBoook SQL storage * It fully implements the interface * @see ODateBookAccessBackend * @see OPimAccessBackend */ class ODateBookAccessBackend_SQL : public ODateBookAccessBackend { public: ODateBookAccessBackend_SQL( const QString& appName, const QString& fileName = QString::null); ~ODateBookAccessBackend_SQL(); @@ -39,24 +42,24 @@ public: OEvent::ValueList directNonRepeats(); OEvent::ValueList directRawRepeats(); private: bool loadFile(); QString m_fileName; QArray<int> m_uids; QMap<int, QString> m_fieldMap; QMap<QString, int> m_reverseFieldMap; - OSQLDriver* m_driver; + Opie::DB::OSQLDriver* m_driver; class Private; Private *d; void initFields(); void update(); - QArray<int> extractUids( OSQLResult& res ) const; + QArray<int> extractUids( Opie::DB::OSQLResult& res ) const; }; #endif diff --git a/libopie/pim/otodoaccesssql.cpp b/libopie/pim/otodoaccesssql.cpp index 3764c7e..fd01a42 100644 --- a/libopie/pim/otodoaccesssql.cpp +++ b/libopie/pim/otodoaccesssql.cpp @@ -4,24 +4,25 @@ #include <qpe/global.h> #include <opie2/osqldriver.h> #include <opie2/osqlresult.h> #include <opie2/osqlmanager.h> #include <opie2/osqlquery.h> #include "otodoaccesssql.h" #include "opimstate.h" #include "opimnotifymanager.h" #include "orecur.h" +using namespace Opie::DB; /* * first some query * CREATE query * LOAD query * INSERT * REMOVE * CLEAR */ namespace { /** * CreateQuery for the Todolist Table */ diff --git a/libopie/pim/otodoaccesssql.h b/libopie/pim/otodoaccesssql.h index 1c55567..72214de 100644 --- a/libopie/pim/otodoaccesssql.h +++ b/libopie/pim/otodoaccesssql.h @@ -1,22 +1,27 @@ #ifndef OPIE_PIM_ACCESS_SQL_H #define OPIE_PIM_ACCESS_SQL_H #include <qasciidict.h> #include "otodoaccessbackend.h" +namespace Opie{ +namespace DB { class OSQLDriver; class OSQLResult; class OSQLResultItem; +} +} + class OTodoAccessBackendSQL : public OTodoAccessBackend { public: OTodoAccessBackendSQL( const QString& file ); ~OTodoAccessBackendSQL(); bool load(); bool reload(); bool save(); QArray<int> allRecords()const; QArray<int> queryByExample( const OTodo& t, int settings, const QDateTime& d = QDateTime() ); OTodo find(int uid)const; @@ -31,26 +36,26 @@ public: const QDate& end, bool includeNoDates ); QArray<int> sorted(bool asc, int sortOrder, int sortFilter, int cat ); QBitArray supports()const; QArray<int> matchRegexp( const QRegExp &r ) const; void removeAllCompleted(); private: void update()const; void fillDict(); inline bool date( QDate& date, const QString& )const; - inline OTodo todo( const OSQLResult& )const; - inline OTodo todo( OSQLResultItem& )const; - inline QArray<int> uids( const OSQLResult& )const; + inline OTodo todo( const Opie::DB::OSQLResult& )const; + inline OTodo todo( Opie::DB::OSQLResultItem& )const; + inline QArray<int> uids( const Opie::DB::OSQLResult& )const; OTodo todo( int uid )const; QBitArray sup() const; QAsciiDict<int> m_dict; - OSQLDriver* m_driver; + Opie::DB::OSQLDriver* m_driver; QArray<int> m_uids; bool m_dirty : 1; }; #endif |