Diffstat (limited to 'libopie2/opiepim/backend/odatebookaccessbackend_sql.h') (more/less context) (show whitespace changes)
-rw-r--r-- | libopie2/opiepim/backend/odatebookaccessbackend_sql.h | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/libopie2/opiepim/backend/odatebookaccessbackend_sql.h b/libopie2/opiepim/backend/odatebookaccessbackend_sql.h index f39e154..89939ef 100644 --- a/libopie2/opiepim/backend/odatebookaccessbackend_sql.h +++ b/libopie2/opiepim/backend/odatebookaccessbackend_sql.h | |||
@@ -1,34 +1,63 @@ | |||
1 | /* | ||
2 | This file is part of the Opie Project | ||
3 | Copyright (C) Stefan Eilers (Eilers.Stefan@epost.de) | ||
4 | =. Copyright (C) The Opie Team <opie-devel@handhelds.org> | ||
5 | .=l. | ||
6 | .>+-= | ||
7 | _;:, .> :=|. This program is free software; you can | ||
8 | .> <`_, > . <= redistribute it and/or modify it under | ||
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | ||
10 | .="- .-=="i, .._ License as published by the Free Software | ||
11 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
12 | ._= =} : or (at your option) any later version. | ||
13 | .%`+i> _;_. | ||
14 | .i_,=:_. -<s. This program is distributed in the hope that | ||
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
16 | : .. .:, . . . without even the implied warranty of | ||
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
19 | ..}^=.= = ; Library General Public License for more | ||
20 | ++= -. .` .: details. | ||
21 | : = ...= . :.=- | ||
22 | -. .:....=;==+<; You should have received a copy of the GNU | ||
23 | -_. . . )=. = Library General Public License along with | ||
24 | -- :-=` this library; see the file COPYING.LIB. | ||
25 | If not, write to the Free Software Foundation, | ||
26 | Inc., 59 Temple Place - Suite 330, | ||
27 | Boston, MA 02111-1307, USA. | ||
28 | */ | ||
1 | #ifndef OPIE_DATE_BOOK_ACCESS_BACKEND_SQL__H | 29 | #ifndef OPIE_DATE_BOOK_ACCESS_BACKEND_SQL__H |
2 | #define OPIE_DATE_BOOK_ACCESS_BACKEND_SQL__H | 30 | #define OPIE_DATE_BOOK_ACCESS_BACKEND_SQL__H |
3 | 31 | ||
4 | #include <qmap.h> | 32 | #include <qmap.h> |
5 | #include <opie2/osqlresult.h> | 33 | #include <opie2/osqlresult.h> |
6 | 34 | ||
7 | #include "odatebookaccessbackend.h" | 35 | #include <opie2/odatebookaccessbackend.h> |
8 | 36 | ||
9 | class OSQLDriver; | 37 | class OSQLDriver; |
10 | 38 | ||
39 | namespace Opie { | ||
11 | /** | 40 | /** |
12 | * This is the default SQL implementation for DateBoook SQL storage | 41 | * This is the default SQL implementation for DateBoook SQL storage |
13 | * It fully implements the interface | 42 | * It fully implements the interface |
14 | * @see ODateBookAccessBackend | 43 | * @see ODateBookAccessBackend |
15 | * @see OPimAccessBackend | 44 | * @see OPimAccessBackend |
16 | */ | 45 | */ |
17 | class ODateBookAccessBackend_SQL : public ODateBookAccessBackend { | 46 | class ODateBookAccessBackend_SQL : public ODateBookAccessBackend { |
18 | public: | 47 | public: |
19 | ODateBookAccessBackend_SQL( const QString& appName, | 48 | ODateBookAccessBackend_SQL( const QString& appName, |
20 | const QString& fileName = QString::null); | 49 | const QString& fileName = QString::null); |
21 | ~ODateBookAccessBackend_SQL(); | 50 | ~ODateBookAccessBackend_SQL(); |
22 | 51 | ||
23 | bool load(); | 52 | bool load(); |
24 | bool reload(); | 53 | bool reload(); |
25 | bool save(); | 54 | bool save(); |
26 | 55 | ||
27 | QArray<int> allRecords()const; | 56 | QArray<int> allRecords()const; |
28 | QArray<int> matchRegexp(const QRegExp &r) const; | 57 | QArray<int> matchRegexp(const QRegExp &r) const; |
29 | QArray<int> queryByExample( const OEvent&, int, const QDateTime& d = QDateTime() ); | 58 | QArray<int> queryByExample( const OEvent&, int, const QDateTime& d = QDateTime() ); |
30 | OEvent find( int uid )const; | 59 | OEvent find( int uid )const; |
31 | void clear(); | 60 | void clear(); |
32 | bool add( const OEvent& ev ); | 61 | bool add( const OEvent& ev ); |
33 | bool remove( int uid ); | 62 | bool remove( int uid ); |
34 | bool replace( const OEvent& ev ); | 63 | bool replace( const OEvent& ev ); |
@@ -38,25 +67,27 @@ public: | |||
38 | QArray<UID> nonRepeats()const; | 67 | QArray<UID> nonRepeats()const; |
39 | 68 | ||
40 | OEvent::ValueList directNonRepeats(); | 69 | OEvent::ValueList directNonRepeats(); |
41 | OEvent::ValueList directRawRepeats(); | 70 | OEvent::ValueList directRawRepeats(); |
42 | 71 | ||
43 | private: | 72 | private: |
44 | bool loadFile(); | 73 | bool loadFile(); |
45 | QString m_fileName; | 74 | QString m_fileName; |
46 | QArray<int> m_uids; | 75 | QArray<int> m_uids; |
47 | 76 | ||
48 | QMap<int, QString> m_fieldMap; | 77 | QMap<int, QString> m_fieldMap; |
49 | QMap<QString, int> m_reverseFieldMap; | 78 | QMap<QString, int> m_reverseFieldMap; |
50 | 79 | ||
51 | OSQLDriver* m_driver; | 80 | OSQLDriver* m_driver; |
52 | 81 | ||
53 | class Private; | 82 | class Private; |
54 | Private *d; | 83 | Private *d; |
55 | 84 | ||
56 | void initFields(); | 85 | void initFields(); |
57 | void update(); | 86 | void update(); |
58 | QArray<int> extractUids( OSQLResult& res ) const; | 87 | QArray<int> extractUids( OSQLResult& res ) const; |
59 | 88 | ||
60 | }; | 89 | }; |
61 | 90 | ||
91 | } | ||
92 | |||
62 | #endif | 93 | #endif |