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