summaryrefslogtreecommitdiff
path: root/libopie2/opiepim/backend/odatebookaccessbackend_sql.h
Unidiff
Diffstat (limited to 'libopie2/opiepim/backend/odatebookaccessbackend_sql.h') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/backend/odatebookaccessbackend_sql.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/libopie2/opiepim/backend/odatebookaccessbackend_sql.h b/libopie2/opiepim/backend/odatebookaccessbackend_sql.h
index cbfeb97..60d7f21 100644
--- a/libopie2/opiepim/backend/odatebookaccessbackend_sql.h
+++ b/libopie2/opiepim/backend/odatebookaccessbackend_sql.h
@@ -13,81 +13,85 @@
13 .%`+i> _;_. 13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that 14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY; 15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of 16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A 17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU 18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more 19..}^=.= = ; Library General Public License for more
20++= -. .` .: details. 20++= -. .` .: details.
21 : = ...= . :.=- 21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU 22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with 23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB. 24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28*/ 28*/
29#ifndef OPIE_DATE_BOOK_ACCESS_BACKEND_SQL__H 29#ifndef OPIE_DATE_BOOK_ACCESS_BACKEND_SQL__H
30#define OPIE_DATE_BOOK_ACCESS_BACKEND_SQL__H 30#define OPIE_DATE_BOOK_ACCESS_BACKEND_SQL__H
31 31
32#include <qmap.h> 32#include <qmap.h>
33#include <opie2/osqlresult.h> 33#include <opie2/osqlresult.h>
34 34
35#include <opie2/odatebookaccessbackend.h> 35#include <opie2/odatebookaccessbackend.h>
36 36
37namespace Opie {
38namespace DB {
37class OSQLDriver; 39class OSQLDriver;
40}
41}
38 42
39namespace Opie { 43namespace Opie {
40/** 44/**
41 * This is the default SQL implementation for DateBoook SQL storage 45 * This is the default SQL implementation for DateBoook SQL storage
42 * It fully implements the interface 46 * It fully implements the interface
43 * @see ODateBookAccessBackend 47 * @see ODateBookAccessBackend
44 * @see OPimAccessBackend 48 * @see OPimAccessBackend
45 */ 49 */
46class ODateBookAccessBackend_SQL : public ODateBookAccessBackend { 50class ODateBookAccessBackend_SQL : public ODateBookAccessBackend {
47public: 51public:
48 ODateBookAccessBackend_SQL( const QString& appName, 52 ODateBookAccessBackend_SQL( const QString& appName,
49 const QString& fileName = QString::null); 53 const QString& fileName = QString::null);
50 ~ODateBookAccessBackend_SQL(); 54 ~ODateBookAccessBackend_SQL();
51 55
52 bool load(); 56 bool load();
53 bool reload(); 57 bool reload();
54 bool save(); 58 bool save();
55 59
56 QArray<int> allRecords()const; 60 QArray<int> allRecords()const;
57 QArray<int> matchRegexp(const QRegExp &r) const; 61 QArray<int> matchRegexp(const QRegExp &r) const;
58 QArray<int> queryByExample( const OPimEvent&, int, const QDateTime& d = QDateTime() ); 62 QArray<int> queryByExample( const OPimEvent&, int, const QDateTime& d = QDateTime() );
59 OPimEvent find( int uid )const; 63 OPimEvent find( int uid )const;
60 void clear(); 64 void clear();
61 bool add( const OPimEvent& ev ); 65 bool add( const OPimEvent& ev );
62 bool remove( int uid ); 66 bool remove( int uid );
63 bool replace( const OPimEvent& ev ); 67 bool replace( const OPimEvent& ev );
64 68
65 QArray<UID> rawEvents()const; 69 QArray<UID> rawEvents()const;
66 QArray<UID> rawRepeats()const; 70 QArray<UID> rawRepeats()const;
67 QArray<UID> nonRepeats()const; 71 QArray<UID> nonRepeats()const;
68 72
69 OPimEvent::ValueList directNonRepeats(); 73 OPimEvent::ValueList directNonRepeats();
70 OPimEvent::ValueList directRawRepeats(); 74 OPimEvent::ValueList directRawRepeats();
71 75
72private: 76private:
73 bool loadFile(); 77 bool loadFile();
74 QString m_fileName; 78 QString m_fileName;
75 QArray<int> m_uids; 79 QArray<int> m_uids;
76 80
77 QMap<int, QString> m_fieldMap; 81 QMap<int, QString> m_fieldMap;
78 QMap<QString, int> m_reverseFieldMap; 82 QMap<QString, int> m_reverseFieldMap;
79 83
80 OSQLDriver* m_driver; 84 Opie::DB::OSQLDriver* m_driver;
81 85
82 class Private; 86 class Private;
83 Private *d; 87 Private *d;
84 88
85 void initFields(); 89 void initFields();
86 void update(); 90 void update();
87 QArray<int> extractUids( OSQLResult& res ) const; 91 QArray<int> extractUids( Opie::DB::OSQLResult& res ) const;
88 92
89}; 93};
90 94
91} 95}
92 96
93#endif 97#endif