Diffstat (limited to 'libopie/pim/ocontactaccessbackend_sql.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie/pim/ocontactaccessbackend_sql.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libopie/pim/ocontactaccessbackend_sql.h b/libopie/pim/ocontactaccessbackend_sql.h index bb22551..b8f1d8d 100644 --- a/libopie/pim/ocontactaccessbackend_sql.h +++ b/libopie/pim/ocontactaccessbackend_sql.h | |||
@@ -1,96 +1,101 @@ | |||
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.2 2003/12/08 15:18:11 eilers | ||
20 | * Committing unfinished sql implementation before merging to libopie2 starts.. | ||
21 | * | ||
19 | * Revision 1.1 2003/09/22 14:31:16 eilers | 22 | * Revision 1.1 2003/09/22 14:31:16 eilers |
20 | * Added first experimental incarnation of sql-backend for addressbook. | 23 | * Added first experimental incarnation of sql-backend for addressbook. |
21 | * Some modifications to be able to compile the todo sql-backend. | 24 | * Some modifications to be able to compile the todo sql-backend. |
22 | * A lot of changes fill follow... | 25 | * A lot of changes fill follow... |
23 | * | 26 | * |
24 | * | 27 | * |
25 | */ | 28 | */ |
26 | 29 | ||
27 | #ifndef _OContactAccessBackend_SQL_ | 30 | #ifndef _OContactAccessBackend_SQL_ |
28 | #define _OContactAccessBackend_SQL_ | 31 | #define _OContactAccessBackend_SQL_ |
29 | 32 | ||
30 | #include "ocontactaccessbackend.h" | 33 | #include "ocontactaccessbackend.h" |
31 | #include "ocontactaccess.h" | 34 | #include "ocontactaccess.h" |
32 | 35 | ||
33 | #include <qlist.h> | 36 | #include <qlist.h> |
34 | #include <qdict.h> | 37 | #include <qdict.h> |
35 | 38 | ||
36 | class OSQLDriver; | 39 | class OSQLDriver; |
37 | class OSQLResult; | 40 | class OSQLResult; |
38 | class OSQLResultItem; | 41 | class OSQLResultItem; |
39 | 42 | ||
40 | /* the default xml implementation */ | 43 | /* the default xml implementation */ |
41 | /** | 44 | /** |
42 | * This class is the SQL implementation of a Contact backend | 45 | * This class is the SQL implementation of a Contact backend |
43 | * it does implement everything available for OContact. | 46 | * it does implement everything available for OContact. |
44 | * @see OPimAccessBackend for more information of available methods | 47 | * @see OPimAccessBackend for more information of available methods |
45 | */ | 48 | */ |
46 | class OContactAccessBackend_SQL : public OContactAccessBackend { | 49 | class OContactAccessBackend_SQL : public OContactAccessBackend { |
47 | public: | 50 | public: |
48 | OContactAccessBackend_SQL ( const QString& appname, const QString& filename = QString::null ); | 51 | OContactAccessBackend_SQL ( const QString& appname, const QString& filename = QString::null ); |
49 | 52 | ||
53 | ~OContactAccessBackend_SQL (); | ||
54 | |||
50 | bool save(); | 55 | bool save(); |
51 | 56 | ||
52 | bool load (); | 57 | bool load (); |
53 | 58 | ||
54 | void clear (); | 59 | void clear (); |
55 | 60 | ||
56 | bool wasChangedExternally(); | 61 | bool wasChangedExternally(); |
57 | 62 | ||
58 | QArray<int> allRecords() const; | 63 | QArray<int> allRecords() const; |
59 | 64 | ||
60 | OContact find ( int uid ) const; | 65 | OContact find ( int uid ) const; |
61 | // FIXME: Add lookahead-cache support ! | 66 | // FIXME: Add lookahead-cache support ! |
62 | //OContact find(int uid, const QArray<int>&, uint cur, Frontend::CacheDirection )const; | 67 | //OContact find(int uid, const QArray<int>&, uint cur, Frontend::CacheDirection )const; |
63 | 68 | ||
64 | QArray<int> queryByExample ( const OContact &query, int settings, | 69 | QArray<int> queryByExample ( const OContact &query, int settings, |
65 | const QDateTime& d ); | 70 | const QDateTime& d ); |
66 | 71 | ||
67 | QArray<int> matchRegexp( const QRegExp &r ) const; | 72 | QArray<int> matchRegexp( const QRegExp &r ) const; |
68 | 73 | ||
69 | const uint querySettings(); | 74 | const uint querySettings(); |
70 | 75 | ||
71 | bool hasQuerySettings (uint querySettings) const; | 76 | bool hasQuerySettings (uint querySettings) const; |
72 | 77 | ||
73 | // Currently only asc implemented.. | 78 | // Currently only asc implemented.. |
74 | QArray<int> sorted( bool asc, int , int , int ); | 79 | QArray<int> sorted( bool asc, int , int , int ); |
75 | bool add ( const OContact &newcontact ); | 80 | bool add ( const OContact &newcontact ); |
76 | 81 | ||
77 | bool replace ( const OContact &contact ); | 82 | bool replace ( const OContact &contact ); |
78 | 83 | ||
79 | bool remove ( int uid ); | 84 | bool remove ( int uid ); |
80 | bool reload(); | 85 | bool reload(); |
81 | 86 | ||
82 | private: | 87 | private: |
83 | QArray<int> extractUids( OSQLResult& res ) const; | 88 | QArray<int> extractUids( OSQLResult& res ) const; |
84 | QMap<int, QString> requestNonCustom( int uid ) const; | 89 | QMap<int, QString> requestNonCustom( int uid ) const; |
85 | QMap<QString, QString> requestCustom( int uid ) const; | 90 | QMap<QString, QString> requestCustom( int uid ) const; |
86 | void update(); | 91 | void update(); |
87 | 92 | ||
88 | protected: | 93 | protected: |
89 | bool m_changed; | 94 | bool m_changed; |
90 | QString m_fileName; | 95 | QString m_fileName; |
91 | QArray<int> m_uids; | 96 | QArray<int> m_uids; |
92 | 97 | ||
93 | OSQLDriver* m_driver; | 98 | OSQLDriver* m_driver; |
94 | }; | 99 | }; |
95 | 100 | ||
96 | #endif | 101 | #endif |