author | eilers <eilers> | 2003-12-08 15:18:10 (UTC) |
---|---|---|
committer | eilers <eilers> | 2003-12-08 15:18:10 (UTC) |
commit | 6974a4bbdc674a2a5d41d801f80035a183faedb5 (patch) (unidiff) | |
tree | 09a719ef263047e92ffb866da13168b7f7d41f23 /libopie/pim/odatebookaccessbackend_sql.h | |
parent | 7f2f736597490fd1592d7ed1f40e4abf824673c0 (diff) | |
download | opie-6974a4bbdc674a2a5d41d801f80035a183faedb5.zip opie-6974a4bbdc674a2a5d41d801f80035a183faedb5.tar.gz opie-6974a4bbdc674a2a5d41d801f80035a183faedb5.tar.bz2 |
Committing unfinished sql implementation before merging to libopie2 starts..
Diffstat (limited to 'libopie/pim/odatebookaccessbackend_sql.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie/pim/odatebookaccessbackend_sql.h | 60 |
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 | |||
8 | class 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 | */ | ||
16 | class ODateBookAccessBackend_SQL : public ODateBookAccessBackend { | ||
17 | public: | ||
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 | |||
42 | private: | ||
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 | ||