Diffstat (limited to 'libopie/pim/ocontactaccessbackend_sql.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie/pim/ocontactaccessbackend_sql.h | 10 |
1 files changed, 8 insertions, 2 deletions
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 | ||
42 | namespace Opie { namespace DB { | ||
39 | class OSQLDriver; | 43 | class OSQLDriver; |
40 | class OSQLResult; | 44 | class OSQLResult; |
41 | class OSQLResultItem; | 45 | class 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 | */ |
49 | class OContactAccessBackend_SQL : public OContactAccessBackend { | 55 | class 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 |