summaryrefslogtreecommitdiff
authoralwin <alwin>2004-03-14 13:50:35 (UTC)
committer alwin <alwin>2004-03-14 13:50:35 (UTC)
commit346288b5a95b72a84fabe9acb2e32aa8a8388c8c (patch) (unidiff)
treedd8a5e79020d05452d8568d626e77fed7d0f4e74
parent0f7217afa7cdcb108dd2afba0ff6b42c97ab6f44 (diff)
downloadopie-346288b5a95b72a84fabe9acb2e32aa8a8388c8c.zip
opie-346288b5a95b72a84fabe9acb2e32aa8a8388c8c.tar.gz
opie-346288b5a95b72a84fabe9acb2e32aa8a8388c8c.tar.bz2
namespace correction
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/pim/ocontactaccessbackend_sql.cpp5
-rw-r--r--libopie/pim/ocontactaccessbackend_sql.h10
-rw-r--r--libopie/pim/odatebookaccessbackend_sql.cpp4
-rw-r--r--libopie/pim/odatebookaccessbackend_sql.h7
-rw-r--r--libopie/pim/otodoaccesssql.cpp1
-rw-r--r--libopie/pim/otodoaccesssql.h13
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
@@ -1,84 +1,87 @@
1/* 1/*
2 * SQL Backend for the OPIE-Contact Database. 2 * SQL Backend for the OPIE-Contact Database.
3 * 3 *
4 * Copyright (c) 2002 by Stefan Eilers (Eilers.Stefan@epost.de) 4 * Copyright (c) 2002 by Stefan Eilers (Eilers.Stefan@epost.de)
5 * 5 *
6 * ===================================================================== 6 * =====================================================================
7 *This program is free software; you can redistribute it and/or 7 *This program is free software; you can redistribute it and/or
8 *modify it under the terms of the GNU Library General Public 8 *modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
11 * ===================================================================== 11 * =====================================================================
12 * ===================================================================== 12 * =====================================================================
13 * Version: $Id$ 13 * Version: $Id$
14 * ===================================================================== 14 * =====================================================================
15 * History: 15 * History:
16 * $Log$ 16 * $Log$
17 * Revision 1.5 2004/03/14 13:50:35 alwin
18 * namespace correction
19 *
17 * Revision 1.4 2003/12/22 10:19:26 eilers 20 * Revision 1.4 2003/12/22 10:19:26 eilers
18 * Finishing implementation of sql-backend for datebook. But I have to 21 * Finishing implementation of sql-backend for datebook. But I have to
19 * port the PIM datebook application to use it, before I could debug the 22 * port the PIM datebook application to use it, before I could debug the
20 * whole stuff. 23 * whole stuff.
21 * Thus, PIM-Database backend is finished, but highly experimental. And some 24 * Thus, PIM-Database backend is finished, but highly experimental. And some
22 * parts are still generic. For instance, the "queryByExample()" methods are 25 * parts are still generic. For instance, the "queryByExample()" methods are
23 * not (or not fully) implemented. Todo: custom-entries not stored. 26 * not (or not fully) implemented. Todo: custom-entries not stored.
24 * The big show stopper: matchRegExp() (needed by OpieSearch) needs regular 27 * The big show stopper: matchRegExp() (needed by OpieSearch) needs regular
25 * expression search in the database, which is not supported by sqlite ! 28 * expression search in the database, which is not supported by sqlite !
26 * Therefore we need either an extended sqlite or a workaround which would 29 * Therefore we need either an extended sqlite or a workaround which would
27 * be very slow and memory consuming.. 30 * be very slow and memory consuming..
28 * 31 *
29 * Revision 1.3 2003/12/08 15:18:10 eilers 32 * Revision 1.3 2003/12/08 15:18:10 eilers
30 * Committing unfinished sql implementation before merging to libopie2 starts.. 33 * Committing unfinished sql implementation before merging to libopie2 starts..
31 * 34 *
32 * Revision 1.2 2003/09/29 07:44:26 eilers 35 * Revision 1.2 2003/09/29 07:44:26 eilers
33 * Improvement of PIM-SQL Databases, but search queries are still limited. 36 * Improvement of PIM-SQL Databases, but search queries are still limited.
34 * Addressbook: Changed table layout. Now, we just need 1/3 of disk-space. 37 * Addressbook: Changed table layout. Now, we just need 1/3 of disk-space.
35 * Todo: Started to add new attributes. Some type conversions missing. 38 * Todo: Started to add new attributes. Some type conversions missing.
36 * 39 *
37 * Revision 1.1 2003/09/22 14:31:16 eilers 40 * Revision 1.1 2003/09/22 14:31:16 eilers
38 * Added first experimental incarnation of sql-backend for addressbook. 41 * Added first experimental incarnation of sql-backend for addressbook.
39 * Some modifications to be able to compile the todo sql-backend. 42 * Some modifications to be able to compile the todo sql-backend.
40 * A lot of changes fill follow... 43 * A lot of changes fill follow...
41 * 44 *
42 */ 45 */
43 46
44#include "ocontactaccessbackend_sql.h" 47#include "ocontactaccessbackend_sql.h"
45 48
46#include <qarray.h> 49#include <qarray.h>
47#include <qdatetime.h> 50#include <qdatetime.h>
48#include <qstringlist.h> 51#include <qstringlist.h>
49 52
50#include <qpe/global.h> 53#include <qpe/global.h>
51#include <qpe/recordfields.h> 54#include <qpe/recordfields.h>
52 55
53#include <opie/ocontactfields.h> 56#include <opie/ocontactfields.h>
54#include <opie/oconversion.h> 57#include <opie/oconversion.h>
55#include <opie2/osqldriver.h> 58#include <opie2/osqldriver.h>
56#include <opie2/osqlresult.h> 59#include <opie2/osqlresult.h>
57#include <opie2/osqlmanager.h> 60#include <opie2/osqlmanager.h>
58#include <opie2/osqlquery.h> 61#include <opie2/osqlquery.h>
59 62
60 63using namespace Opie::DB;
61 64
62 65
63// If defined, we use a horizontal table ( uid, attr1, attr2, attr3, ..., attrn ) instead 66// If defined, we use a horizontal table ( uid, attr1, attr2, attr3, ..., attrn ) instead
64// vertical like "uid, type, value". 67// vertical like "uid, type, value".
65// DON'T DEACTIVATE THIS DEFINE IN PRODUCTIVE ENVIRONMENTS !! 68// DON'T DEACTIVATE THIS DEFINE IN PRODUCTIVE ENVIRONMENTS !!
66#define __STORE_HORIZONTAL_ 69#define __STORE_HORIZONTAL_
67 70
68// Distinct loading is not very fast. If I expect that every person has just 71// Distinct loading is not very fast. If I expect that every person has just
69// one (and always one) 'Last Name', I can request all uid's for existing lastnames, 72// one (and always one) 'Last Name', I can request all uid's for existing lastnames,
70// which is faster.. 73// which is faster..
71// But this may not be true for all entries, like company contacts.. 74// But this may not be true for all entries, like company contacts..
72// The current AddressBook application handles this problem, but other may not.. (eilers) 75// The current AddressBook application handles this problem, but other may not.. (eilers)
73#define __USE_SUPERFAST_LOADQUERY 76#define __USE_SUPERFAST_LOADQUERY
74 77
75 78
76/* 79/*
77 * Implementation of used query types 80 * Implementation of used query types
78 * CREATE query 81 * CREATE query
79 * LOAD query 82 * LOAD query
80 * INSERT 83 * INSERT
81 * REMOVE 84 * REMOVE
82 * CLEAR 85 * CLEAR
83 */ 86 */
84namespace { 87namespace {
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
@@ -1,101 +1,107 @@
1/* 1/*
2 * SQL Backend for the OPIE-Contact Database. 2 * SQL Backend for the OPIE-Contact Database.
3 * 3 *
4 * Copyright (c) 2002 by Stefan Eilers (Eilers.Stefan@epost.de) 4 * Copyright (c) 2002 by Stefan Eilers (Eilers.Stefan@epost.de)
5 * 5 *
6 * ===================================================================== 6 * =====================================================================
7 *This program is free software; you can redistribute it and/or 7 *This program is free software; you can redistribute it and/or
8 *modify it under the terms of the GNU Library General Public 8 *modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
11 * ===================================================================== 11 * =====================================================================
12 * 12 *
13 * 13 *
14 * ===================================================================== 14 * =====================================================================
15 * Version: $Id$ 15 * Version: $Id$
16 * ===================================================================== 16 * =====================================================================
17 * History: 17 * History:
18 * $Log$ 18 * $Log$
19 * Revision 1.3 2004/03/14 13:50:35 alwin
20 * namespace correction
21 *
19 * Revision 1.2 2003/12/08 15:18:11 eilers 22 * Revision 1.2 2003/12/08 15:18:11 eilers
20 * Committing unfinished sql implementation before merging to libopie2 starts.. 23 * Committing unfinished sql implementation before merging to libopie2 starts..
21 * 24 *
22 * Revision 1.1 2003/09/22 14:31:16 eilers 25 * Revision 1.1 2003/09/22 14:31:16 eilers
23 * Added first experimental incarnation of sql-backend for addressbook. 26 * Added first experimental incarnation of sql-backend for addressbook.
24 * Some modifications to be able to compile the todo sql-backend. 27 * Some modifications to be able to compile the todo sql-backend.
25 * A lot of changes fill follow... 28 * A lot of changes fill follow...
26 * 29 *
27 * 30 *
28 */ 31 */
29 32
30#ifndef _OContactAccessBackend_SQL_ 33#ifndef _OContactAccessBackend_SQL_
31#define _OContactAccessBackend_SQL_ 34#define _OContactAccessBackend_SQL_
32 35
33#include "ocontactaccessbackend.h" 36#include "ocontactaccessbackend.h"
34#include "ocontactaccess.h" 37#include "ocontactaccess.h"
35 38
36#include <qlist.h> 39#include <qlist.h>
37#include <qdict.h> 40#include <qdict.h>
38 41
42namespace Opie { namespace DB {
39class OSQLDriver; 43class OSQLDriver;
40class OSQLResult; 44class OSQLResult;
41class OSQLResultItem; 45class OSQLResultItem;
42 46
47}}
48
43/* the default xml implementation */ 49/* the default xml implementation */
44/** 50/**
45 * This class is the SQL implementation of a Contact backend 51 * This class is the SQL implementation of a Contact backend
46 * it does implement everything available for OContact. 52 * it does implement everything available for OContact.
47 * @see OPimAccessBackend for more information of available methods 53 * @see OPimAccessBackend for more information of available methods
48 */ 54 */
49class OContactAccessBackend_SQL : public OContactAccessBackend { 55class OContactAccessBackend_SQL : public OContactAccessBackend {
50 public: 56 public:
51 OContactAccessBackend_SQL ( const QString& appname, const QString& filename = QString::null ); 57 OContactAccessBackend_SQL ( const QString& appname, const QString& filename = QString::null );
52 58
53 ~OContactAccessBackend_SQL (); 59 ~OContactAccessBackend_SQL ();
54 60
55 bool save(); 61 bool save();
56 62
57 bool load (); 63 bool load ();
58 64
59 void clear (); 65 void clear ();
60 66
61 bool wasChangedExternally(); 67 bool wasChangedExternally();
62 68
63 QArray<int> allRecords() const; 69 QArray<int> allRecords() const;
64 70
65 OContact find ( int uid ) const; 71 OContact find ( int uid ) const;
66 // FIXME: Add lookahead-cache support ! 72 // FIXME: Add lookahead-cache support !
67 //OContact find(int uid, const QArray<int>&, uint cur, Frontend::CacheDirection )const; 73 //OContact find(int uid, const QArray<int>&, uint cur, Frontend::CacheDirection )const;
68 74
69 QArray<int> queryByExample ( const OContact &query, int settings, 75 QArray<int> queryByExample ( const OContact &query, int settings,
70 const QDateTime& d ); 76 const QDateTime& d );
71 77
72 QArray<int> matchRegexp( const QRegExp &r ) const; 78 QArray<int> matchRegexp( const QRegExp &r ) const;
73 79
74 const uint querySettings(); 80 const uint querySettings();
75 81
76 bool hasQuerySettings (uint querySettings) const; 82 bool hasQuerySettings (uint querySettings) const;
77 83
78 // Currently only asc implemented.. 84 // Currently only asc implemented..
79 QArray<int> sorted( bool asc, int , int , int ); 85 QArray<int> sorted( bool asc, int , int , int );
80 bool add ( const OContact &newcontact ); 86 bool add ( const OContact &newcontact );
81 87
82 bool replace ( const OContact &contact ); 88 bool replace ( const OContact &contact );
83 89
84 bool remove ( int uid ); 90 bool remove ( int uid );
85 bool reload(); 91 bool reload();
86 92
87 private: 93 private:
88 QArray<int> extractUids( OSQLResult& res ) const; 94 QArray<int> extractUids( Opie::DB::OSQLResult& res ) const;
89 QMap<int, QString> requestNonCustom( int uid ) const; 95 QMap<int, QString> requestNonCustom( int uid ) const;
90 QMap<QString, QString> requestCustom( int uid ) const; 96 QMap<QString, QString> requestCustom( int uid ) const;
91 void update(); 97 void update();
92 98
93 protected: 99 protected:
94 bool m_changed; 100 bool m_changed;
95 QString m_fileName; 101 QString m_fileName;
96 QArray<int> m_uids; 102 QArray<int> m_uids;
97 103
98 OSQLDriver* m_driver; 104 Opie::DB::OSQLDriver* m_driver;
99}; 105};
100 106
101#endif 107#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
@@ -1,76 +1,80 @@
1/* 1/*
2 * SQL Backend for the OPIE-Calender Database. 2 * SQL Backend for the OPIE-Calender Database.
3 * 3 *
4 * Copyright (c) 2003 by Stefan Eilers (Eilers.Stefan@epost.de) 4 * Copyright (c) 2003 by Stefan Eilers (Eilers.Stefan@epost.de)
5 * 5 *
6 * ===================================================================== 6 * =====================================================================
7 *This program is free software; you can redistribute it and/or 7 *This program is free software; you can redistribute it and/or
8 *modify it under the terms of the GNU Library General Public 8 *modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
11 * ===================================================================== 11 * =====================================================================
12 * ===================================================================== 12 * =====================================================================
13 * Version: $Id$ 13 * Version: $Id$
14 * ===================================================================== 14 * =====================================================================
15 * History: 15 * History:
16 * $Log$ 16 * $Log$
17 * Revision 1.4 2004/03/14 13:50:35 alwin
18 * namespace correction
19 *
17 * Revision 1.3 2003/12/22 11:41:39 eilers 20 * Revision 1.3 2003/12/22 11:41:39 eilers
18 * Fixing stupid bug, found by sourcode review.. 21 * Fixing stupid bug, found by sourcode review..
19 * 22 *
20 * Revision 1.2 2003/12/22 10:19:26 eilers 23 * Revision 1.2 2003/12/22 10:19:26 eilers
21 * Finishing implementation of sql-backend for datebook. But I have to 24 * Finishing implementation of sql-backend for datebook. But I have to
22 * port the PIM datebook application to use it, before I could debug the 25 * port the PIM datebook application to use it, before I could debug the
23 * whole stuff. 26 * whole stuff.
24 * Thus, PIM-Database backend is finished, but highly experimental. And some 27 * Thus, PIM-Database backend is finished, but highly experimental. And some
25 * parts are still generic. For instance, the "queryByExample()" methods are 28 * parts are still generic. For instance, the "queryByExample()" methods are
26 * not (or not fully) implemented. Todo: custom-entries not stored. 29 * not (or not fully) implemented. Todo: custom-entries not stored.
27 * The big show stopper: matchRegExp() (needed by OpieSearch) needs regular 30 * The big show stopper: matchRegExp() (needed by OpieSearch) needs regular
28 * expression search in the database, which is not supported by sqlite ! 31 * expression search in the database, which is not supported by sqlite !
29 * Therefore we need either an extended sqlite or a workaround which would 32 * Therefore we need either an extended sqlite or a workaround which would
30 * be very slow and memory consuming.. 33 * be very slow and memory consuming..
31 * 34 *
32 * Revision 1.1 2003/12/08 15:18:12 eilers 35 * Revision 1.1 2003/12/08 15:18:12 eilers
33 * Committing unfinished sql implementation before merging to libopie2 starts.. 36 * Committing unfinished sql implementation before merging to libopie2 starts..
34 * 37 *
35 * 38 *
36 */ 39 */
37 40
38#include <stdio.h> 41#include <stdio.h>
39#include <stdlib.h> 42#include <stdlib.h>
40 43
41#include <qarray.h> 44#include <qarray.h>
42#include <qstringlist.h> 45#include <qstringlist.h>
43 46
44#include <qpe/global.h> 47#include <qpe/global.h>
45 48
46#include <opie2/osqldriver.h> 49#include <opie2/osqldriver.h>
47#include <opie2/osqlmanager.h> 50#include <opie2/osqlmanager.h>
48#include <opie2/osqlquery.h> 51#include <opie2/osqlquery.h>
49 52
50#include "orecur.h" 53#include "orecur.h"
51#include "odatebookaccessbackend_sql.h" 54#include "odatebookaccessbackend_sql.h"
52 55
56using namespace Opie::DB;
53 57
54 58
55ODateBookAccessBackend_SQL::ODateBookAccessBackend_SQL( const QString& , 59ODateBookAccessBackend_SQL::ODateBookAccessBackend_SQL( const QString& ,
56 const QString& fileName ) 60 const QString& fileName )
57 : ODateBookAccessBackend(), m_driver( NULL ) 61 : ODateBookAccessBackend(), m_driver( NULL )
58{ 62{
59 m_fileName = fileName.isEmpty() ? Global::applicationFileName( "datebook", "datebook.db" ) : fileName; 63 m_fileName = fileName.isEmpty() ? Global::applicationFileName( "datebook", "datebook.db" ) : fileName;
60 64
61 // Get the standart sql-driver from the OSQLManager.. 65 // Get the standart sql-driver from the OSQLManager..
62 OSQLManager man; 66 OSQLManager man;
63 m_driver = man.standard(); 67 m_driver = man.standard();
64 m_driver->setUrl( m_fileName ); 68 m_driver->setUrl( m_fileName );
65 69
66 initFields(); 70 initFields();
67 71
68 load(); 72 load();
69} 73}
70 74
71ODateBookAccessBackend_SQL::~ODateBookAccessBackend_SQL() { 75ODateBookAccessBackend_SQL::~ODateBookAccessBackend_SQL() {
72 if( m_driver ) 76 if( m_driver )
73 delete m_driver; 77 delete m_driver;
74} 78}
75 79
76void ODateBookAccessBackend_SQL::initFields() 80void ODateBookAccessBackend_SQL::initFields()
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,62 +1,65 @@
1#ifndef OPIE_DATE_BOOK_ACCESS_BACKEND_SQL__H 1#ifndef OPIE_DATE_BOOK_ACCESS_BACKEND_SQL__H
2#define OPIE_DATE_BOOK_ACCESS_BACKEND_SQL__H 2#define OPIE_DATE_BOOK_ACCESS_BACKEND_SQL__H
3 3
4#include <qmap.h> 4#include <qmap.h>
5#include <opie2/osqlresult.h> 5#include <opie2/osqlresult.h>
6 6
7#include "odatebookaccessbackend.h" 7#include "odatebookaccessbackend.h"
8 8
9namespace Opie { namespace DB {
9class OSQLDriver; 10class OSQLDriver;
10 11
12}}
13
11/** 14/**
12 * This is the default SQL implementation for DateBoook SQL storage 15 * This is the default SQL implementation for DateBoook SQL storage
13 * It fully implements the interface 16 * It fully implements the interface
14 * @see ODateBookAccessBackend 17 * @see ODateBookAccessBackend
15 * @see OPimAccessBackend 18 * @see OPimAccessBackend
16 */ 19 */
17class ODateBookAccessBackend_SQL : public ODateBookAccessBackend { 20class ODateBookAccessBackend_SQL : public ODateBookAccessBackend {
18public: 21public:
19 ODateBookAccessBackend_SQL( const QString& appName, 22 ODateBookAccessBackend_SQL( const QString& appName,
20 const QString& fileName = QString::null); 23 const QString& fileName = QString::null);
21 ~ODateBookAccessBackend_SQL(); 24 ~ODateBookAccessBackend_SQL();
22 25
23 bool load(); 26 bool load();
24 bool reload(); 27 bool reload();
25 bool save(); 28 bool save();
26 29
27 QArray<int> allRecords()const; 30 QArray<int> allRecords()const;
28 QArray<int> matchRegexp(const QRegExp &r) const; 31 QArray<int> matchRegexp(const QRegExp &r) const;
29 QArray<int> queryByExample( const OEvent&, int, const QDateTime& d = QDateTime() ); 32 QArray<int> queryByExample( const OEvent&, int, const QDateTime& d = QDateTime() );
30 OEvent find( int uid )const; 33 OEvent find( int uid )const;
31 void clear(); 34 void clear();
32 bool add( const OEvent& ev ); 35 bool add( const OEvent& ev );
33 bool remove( int uid ); 36 bool remove( int uid );
34 bool replace( const OEvent& ev ); 37 bool replace( const OEvent& ev );
35 38
36 QArray<UID> rawEvents()const; 39 QArray<UID> rawEvents()const;
37 QArray<UID> rawRepeats()const; 40 QArray<UID> rawRepeats()const;
38 QArray<UID> nonRepeats()const; 41 QArray<UID> nonRepeats()const;
39 42
40 OEvent::ValueList directNonRepeats(); 43 OEvent::ValueList directNonRepeats();
41 OEvent::ValueList directRawRepeats(); 44 OEvent::ValueList directRawRepeats();
42 45
43private: 46private:
44 bool loadFile(); 47 bool loadFile();
45 QString m_fileName; 48 QString m_fileName;
46 QArray<int> m_uids; 49 QArray<int> m_uids;
47 50
48 QMap<int, QString> m_fieldMap; 51 QMap<int, QString> m_fieldMap;
49 QMap<QString, int> m_reverseFieldMap; 52 QMap<QString, int> m_reverseFieldMap;
50 53
51 OSQLDriver* m_driver; 54 Opie::DB::OSQLDriver* m_driver;
52 55
53 class Private; 56 class Private;
54 Private *d; 57 Private *d;
55 58
56 void initFields(); 59 void initFields();
57 void update(); 60 void update();
58 QArray<int> extractUids( OSQLResult& res ) const; 61 QArray<int> extractUids( Opie::DB::OSQLResult& res ) const;
59 62
60}; 63};
61 64
62#endif 65#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
@@ -1,39 +1,40 @@
1 1
2#include <qdatetime.h> 2#include <qdatetime.h>
3 3
4#include <qpe/global.h> 4#include <qpe/global.h>
5 5
6#include <opie2/osqldriver.h> 6#include <opie2/osqldriver.h>
7#include <opie2/osqlresult.h> 7#include <opie2/osqlresult.h>
8#include <opie2/osqlmanager.h> 8#include <opie2/osqlmanager.h>
9#include <opie2/osqlquery.h> 9#include <opie2/osqlquery.h>
10 10
11#include "otodoaccesssql.h" 11#include "otodoaccesssql.h"
12#include "opimstate.h" 12#include "opimstate.h"
13#include "opimnotifymanager.h" 13#include "opimnotifymanager.h"
14#include "orecur.h" 14#include "orecur.h"
15 15
16using namespace Opie::DB;
16/* 17/*
17 * first some query 18 * first some query
18 * CREATE query 19 * CREATE query
19 * LOAD query 20 * LOAD query
20 * INSERT 21 * INSERT
21 * REMOVE 22 * REMOVE
22 * CLEAR 23 * CLEAR
23 */ 24 */
24namespace { 25namespace {
25 /** 26 /**
26 * CreateQuery for the Todolist Table 27 * CreateQuery for the Todolist Table
27 */ 28 */
28 class CreateQuery : public OSQLQuery { 29 class CreateQuery : public OSQLQuery {
29 public: 30 public:
30 CreateQuery(); 31 CreateQuery();
31 ~CreateQuery(); 32 ~CreateQuery();
32 QString query()const; 33 QString query()const;
33 }; 34 };
34 35
35 /** 36 /**
36 * LoadQuery 37 * LoadQuery
37 * this one queries for all uids 38 * this one queries for all uids
38 */ 39 */
39 class LoadQuery : public OSQLQuery { 40 class LoadQuery : public OSQLQuery {
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,56 +1,61 @@
1#ifndef OPIE_PIM_ACCESS_SQL_H 1#ifndef OPIE_PIM_ACCESS_SQL_H
2#define OPIE_PIM_ACCESS_SQL_H 2#define OPIE_PIM_ACCESS_SQL_H
3 3
4#include <qasciidict.h> 4#include <qasciidict.h>
5 5
6#include "otodoaccessbackend.h" 6#include "otodoaccessbackend.h"
7 7
8namespace Opie{
9namespace DB {
8class OSQLDriver; 10class OSQLDriver;
9class OSQLResult; 11class OSQLResult;
10class OSQLResultItem; 12class OSQLResultItem;
13}
14}
15
11class OTodoAccessBackendSQL : public OTodoAccessBackend { 16class OTodoAccessBackendSQL : public OTodoAccessBackend {
12public: 17public:
13 OTodoAccessBackendSQL( const QString& file ); 18 OTodoAccessBackendSQL( const QString& file );
14 ~OTodoAccessBackendSQL(); 19 ~OTodoAccessBackendSQL();
15 20
16 bool load(); 21 bool load();
17 bool reload(); 22 bool reload();
18 bool save(); 23 bool save();
19 QArray<int> allRecords()const; 24 QArray<int> allRecords()const;
20 25
21 QArray<int> queryByExample( const OTodo& t, int settings, const QDateTime& d = QDateTime() ); 26 QArray<int> queryByExample( const OTodo& t, int settings, const QDateTime& d = QDateTime() );
22 OTodo find(int uid)const; 27 OTodo find(int uid)const;
23 OTodo find(int uid, const QArray<int>&, uint cur, Frontend::CacheDirection )const; 28 OTodo find(int uid, const QArray<int>&, uint cur, Frontend::CacheDirection )const;
24 void clear(); 29 void clear();
25 bool add( const OTodo& t ); 30 bool add( const OTodo& t );
26 bool remove( int uid ); 31 bool remove( int uid );
27 bool replace( const OTodo& t ); 32 bool replace( const OTodo& t );
28 33
29 QArray<int> overDue(); 34 QArray<int> overDue();
30 QArray<int> effectiveToDos( const QDate& start, 35 QArray<int> effectiveToDos( const QDate& start,
31 const QDate& end, bool includeNoDates ); 36 const QDate& end, bool includeNoDates );
32 QArray<int> sorted(bool asc, int sortOrder, int sortFilter, int cat ); 37 QArray<int> sorted(bool asc, int sortOrder, int sortFilter, int cat );
33 38
34 QBitArray supports()const; 39 QBitArray supports()const;
35 QArray<int> matchRegexp( const QRegExp &r ) const; 40 QArray<int> matchRegexp( const QRegExp &r ) const;
36 void removeAllCompleted(); 41 void removeAllCompleted();
37 42
38 43
39private: 44private:
40 void update()const; 45 void update()const;
41 void fillDict(); 46 void fillDict();
42 inline bool date( QDate& date, const QString& )const; 47 inline bool date( QDate& date, const QString& )const;
43 inline OTodo todo( const OSQLResult& )const; 48 inline OTodo todo( const Opie::DB::OSQLResult& )const;
44 inline OTodo todo( OSQLResultItem& )const; 49 inline OTodo todo( Opie::DB::OSQLResultItem& )const;
45 inline QArray<int> uids( const OSQLResult& )const; 50 inline QArray<int> uids( const Opie::DB::OSQLResult& )const;
46 OTodo todo( int uid )const; 51 OTodo todo( int uid )const;
47 QBitArray sup() const; 52 QBitArray sup() const;
48 53
49 QAsciiDict<int> m_dict; 54 QAsciiDict<int> m_dict;
50 OSQLDriver* m_driver; 55 Opie::DB::OSQLDriver* m_driver;
51 QArray<int> m_uids; 56 QArray<int> m_uids;
52 bool m_dirty : 1; 57 bool m_dirty : 1;
53}; 58};
54 59
55 60
56#endif 61#endif