summaryrefslogtreecommitdiff
path: root/libopie/pim/odatebookaccessbackend_sql.h
Unidiff
Diffstat (limited to 'libopie/pim/odatebookaccessbackend_sql.h') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/pim/odatebookaccessbackend_sql.h60
1 files changed, 60 insertions, 0 deletions
diff --git a/libopie/pim/odatebookaccessbackend_sql.h b/libopie/pim/odatebookaccessbackend_sql.h
new file mode 100644
index 0000000..85e0d4f
--- a/dev/null
+++ b/libopie/pim/odatebookaccessbackend_sql.h
@@ -0,0 +1,60 @@
1#ifndef OPIE_DATE_BOOK_ACCESS_BACKEND_SQL__H
2#define OPIE_DATE_BOOK_ACCESS_BACKEND_SQL__H
3
4#include <qmap.h>
5
6#include "odatebookaccessbackend.h"
7
8class OSQLDriver;
9
10/**
11 * This is the default SQL implementation for DateBoook SQL storage
12 * It fully implements the interface
13 * @see ODateBookAccessBackend
14 * @see OPimAccessBackend
15 */
16class ODateBookAccessBackend_SQL : public ODateBookAccessBackend {
17public:
18 ODateBookAccessBackend_SQL( const QString& appName,
19 const QString& fileName = QString::null);
20 ~ODateBookAccessBackend_SQL();
21
22 bool load();
23 bool reload();
24 bool save();
25
26 QArray<int> allRecords()const;
27 QArray<int> matchRegexp(const QRegExp &r) const;
28 QArray<int> queryByExample( const OEvent&, int, const QDateTime& d = QDateTime() );
29 OEvent find( int uid )const;
30 void clear();
31 bool add( const OEvent& ev );
32 bool remove( int uid );
33 bool replace( const OEvent& ev );
34
35 QArray<UID> rawEvents()const;
36 QArray<UID> rawRepeats()const;
37 QArray<UID> nonRepeats()const;
38
39 OEvent::ValueList directNonRepeats();
40 OEvent::ValueList directRawRepeats();
41
42private:
43 bool loadFile();
44 QString m_fileName;
45 QArray<int> m_uids;
46
47 QMap<int, QString> m_fieldMap;
48
49 OSQLDriver* m_driver;
50
51 class Private;
52 Private *d;
53
54 void initFields();
55 void update();
56 QArray<int> extractUids( OSQLResult& res ) const;
57
58};
59
60#endif