author | alwin <alwin> | 2004-03-14 13:50:35 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-03-14 13:50:35 (UTC) |
commit | 346288b5a95b72a84fabe9acb2e32aa8a8388c8c (patch) (unidiff) | |
tree | dd8a5e79020d05452d8568d626e77fed7d0f4e74 | |
parent | 0f7217afa7cdcb108dd2afba0ff6b42c97ab6f44 (diff) | |
download | opie-346288b5a95b72a84fabe9acb2e32aa8a8388c8c.zip opie-346288b5a95b72a84fabe9acb2e32aa8a8388c8c.tar.gz opie-346288b5a95b72a84fabe9acb2e32aa8a8388c8c.tar.bz2 |
namespace correction
-rw-r--r-- | libopie/pim/ocontactaccessbackend_sql.cpp | 5 | ||||
-rw-r--r-- | libopie/pim/ocontactaccessbackend_sql.h | 10 | ||||
-rw-r--r-- | libopie/pim/odatebookaccessbackend_sql.cpp | 4 | ||||
-rw-r--r-- | libopie/pim/odatebookaccessbackend_sql.h | 7 | ||||
-rw-r--r-- | libopie/pim/otodoaccesssql.cpp | 1 | ||||
-rw-r--r-- | libopie/pim/otodoaccesssql.h | 13 |
6 files changed, 31 insertions, 9 deletions
diff --git a/libopie/pim/ocontactaccessbackend_sql.cpp b/libopie/pim/ocontactaccessbackend_sql.cpp index a5be4c8..d20df56 100644 --- a/libopie/pim/ocontactaccessbackend_sql.cpp +++ b/libopie/pim/ocontactaccessbackend_sql.cpp | |||
@@ -9,16 +9,19 @@ | |||
9 | * License as published by the Free Software Foundation; either | 9 | * License as published by the Free Software Foundation; either |
10 | * version 2 of the License, or (at your option) any later version. | 10 | * version 2 of the License, or (at your option) any later version. |
11 | * ===================================================================== | 11 | * ===================================================================== |
12 | * ===================================================================== | 12 | * ===================================================================== |
13 | * Version: $Id$ | 13 | * Version: $Id$ |
14 | * ===================================================================== | 14 | * ===================================================================== |
15 | * History: | 15 | * History: |
16 | * $Log$ | 16 | * $Log$ |
17 | * Revision 1.5 2004/03/14 13:50:35 alwin | ||
18 | * namespace correction | ||
19 | * | ||
17 | * Revision 1.4 2003/12/22 10:19:26 eilers | 20 | * Revision 1.4 2003/12/22 10:19:26 eilers |
18 | * Finishing implementation of sql-backend for datebook. But I have to | 21 | * Finishing implementation of sql-backend for datebook. But I have to |
19 | * port the PIM datebook application to use it, before I could debug the | 22 | * port the PIM datebook application to use it, before I could debug the |
20 | * whole stuff. | 23 | * whole stuff. |
21 | * Thus, PIM-Database backend is finished, but highly experimental. And some | 24 | * Thus, PIM-Database backend is finished, but highly experimental. And some |
22 | * parts are still generic. For instance, the "queryByExample()" methods are | 25 | * parts are still generic. For instance, the "queryByExample()" methods are |
23 | * not (or not fully) implemented. Todo: custom-entries not stored. | 26 | * not (or not fully) implemented. Todo: custom-entries not stored. |
24 | * The big show stopper: matchRegExp() (needed by OpieSearch) needs regular | 27 | * The big show stopper: matchRegExp() (needed by OpieSearch) needs regular |
@@ -52,17 +55,17 @@ | |||
52 | 55 | ||
53 | #include <opie/ocontactfields.h> | 56 | #include <opie/ocontactfields.h> |
54 | #include <opie/oconversion.h> | 57 | #include <opie/oconversion.h> |
55 | #include <opie2/osqldriver.h> | 58 | #include <opie2/osqldriver.h> |
56 | #include <opie2/osqlresult.h> | 59 | #include <opie2/osqlresult.h> |
57 | #include <opie2/osqlmanager.h> | 60 | #include <opie2/osqlmanager.h> |
58 | #include <opie2/osqlquery.h> | 61 | #include <opie2/osqlquery.h> |
59 | 62 | ||
60 | 63 | using namespace Opie::DB; | |
61 | 64 | ||
62 | 65 | ||
63 | // If defined, we use a horizontal table ( uid, attr1, attr2, attr3, ..., attrn ) instead | 66 | // If defined, we use a horizontal table ( uid, attr1, attr2, attr3, ..., attrn ) instead |
64 | // vertical like "uid, type, value". | 67 | // vertical like "uid, type, value". |
65 | // DON'T DEACTIVATE THIS DEFINE IN PRODUCTIVE ENVIRONMENTS !! | 68 | // DON'T DEACTIVATE THIS DEFINE IN PRODUCTIVE ENVIRONMENTS !! |
66 | #define __STORE_HORIZONTAL_ | 69 | #define __STORE_HORIZONTAL_ |
67 | 70 | ||
68 | // Distinct loading is not very fast. If I expect that every person has just | 71 | // Distinct loading is not very fast. If I expect that every person has just |
diff --git a/libopie/pim/ocontactaccessbackend_sql.h b/libopie/pim/ocontactaccessbackend_sql.h index b8f1d8d..f553760 100644 --- a/libopie/pim/ocontactaccessbackend_sql.h +++ b/libopie/pim/ocontactaccessbackend_sql.h | |||
@@ -11,16 +11,19 @@ | |||
11 | * ===================================================================== | 11 | * ===================================================================== |
12 | * | 12 | * |
13 | * | 13 | * |
14 | * ===================================================================== | 14 | * ===================================================================== |
15 | * Version: $Id$ | 15 | * Version: $Id$ |
16 | * ===================================================================== | 16 | * ===================================================================== |
17 | * History: | 17 | * History: |
18 | * $Log$ | 18 | * $Log$ |
19 | * Revision 1.3 2004/03/14 13:50:35 alwin | ||
20 | * namespace correction | ||
21 | * | ||
19 | * Revision 1.2 2003/12/08 15:18:11 eilers | 22 | * Revision 1.2 2003/12/08 15:18:11 eilers |
20 | * Committing unfinished sql implementation before merging to libopie2 starts.. | 23 | * Committing unfinished sql implementation before merging to libopie2 starts.. |
21 | * | 24 | * |
22 | * Revision 1.1 2003/09/22 14:31:16 eilers | 25 | * Revision 1.1 2003/09/22 14:31:16 eilers |
23 | * Added first experimental incarnation of sql-backend for addressbook. | 26 | * Added first experimental incarnation of sql-backend for addressbook. |
24 | * Some modifications to be able to compile the todo sql-backend. | 27 | * Some modifications to be able to compile the todo sql-backend. |
25 | * A lot of changes fill follow... | 28 | * A lot of changes fill follow... |
26 | * | 29 | * |
@@ -31,20 +34,23 @@ | |||
31 | #define _OContactAccessBackend_SQL_ | 34 | #define _OContactAccessBackend_SQL_ |
32 | 35 | ||
33 | #include "ocontactaccessbackend.h" | 36 | #include "ocontactaccessbackend.h" |
34 | #include "ocontactaccess.h" | 37 | #include "ocontactaccess.h" |
35 | 38 | ||
36 | #include <qlist.h> | 39 | #include <qlist.h> |
37 | #include <qdict.h> | 40 | #include <qdict.h> |
38 | 41 | ||
42 | namespace Opie { namespace DB { | ||
39 | class OSQLDriver; | 43 | class OSQLDriver; |
40 | class OSQLResult; | 44 | class OSQLResult; |
41 | class OSQLResultItem; | 45 | class OSQLResultItem; |
42 | 46 | ||
47 | }} | ||
48 | |||
43 | /* the default xml implementation */ | 49 | /* the default xml implementation */ |
44 | /** | 50 | /** |
45 | * This class is the SQL implementation of a Contact backend | 51 | * This class is the SQL implementation of a Contact backend |
46 | * it does implement everything available for OContact. | 52 | * it does implement everything available for OContact. |
47 | * @see OPimAccessBackend for more information of available methods | 53 | * @see OPimAccessBackend for more information of available methods |
48 | */ | 54 | */ |
49 | class OContactAccessBackend_SQL : public OContactAccessBackend { | 55 | class OContactAccessBackend_SQL : public OContactAccessBackend { |
50 | public: | 56 | public: |
@@ -80,22 +86,22 @@ class OContactAccessBackend_SQL : public OContactAccessBackend { | |||
80 | bool add ( const OContact &newcontact ); | 86 | bool add ( const OContact &newcontact ); |
81 | 87 | ||
82 | bool replace ( const OContact &contact ); | 88 | bool replace ( const OContact &contact ); |
83 | 89 | ||
84 | bool remove ( int uid ); | 90 | bool remove ( int uid ); |
85 | bool reload(); | 91 | bool reload(); |
86 | 92 | ||
87 | private: | 93 | private: |
88 | QArray<int> extractUids( OSQLResult& res ) const; | 94 | QArray<int> extractUids( Opie::DB::OSQLResult& res ) const; |
89 | QMap<int, QString> requestNonCustom( int uid ) const; | 95 | QMap<int, QString> requestNonCustom( int uid ) const; |
90 | QMap<QString, QString> requestCustom( int uid ) const; | 96 | QMap<QString, QString> requestCustom( int uid ) const; |
91 | void update(); | 97 | void update(); |
92 | 98 | ||
93 | protected: | 99 | protected: |
94 | bool m_changed; | 100 | bool m_changed; |
95 | QString m_fileName; | 101 | QString m_fileName; |
96 | QArray<int> m_uids; | 102 | QArray<int> m_uids; |
97 | 103 | ||
98 | OSQLDriver* m_driver; | 104 | Opie::DB::OSQLDriver* m_driver; |
99 | }; | 105 | }; |
100 | 106 | ||
101 | #endif | 107 | #endif |
diff --git a/libopie/pim/odatebookaccessbackend_sql.cpp b/libopie/pim/odatebookaccessbackend_sql.cpp index 756f405..44dd2bc 100644 --- a/libopie/pim/odatebookaccessbackend_sql.cpp +++ b/libopie/pim/odatebookaccessbackend_sql.cpp | |||
@@ -9,16 +9,19 @@ | |||
9 | * License as published by the Free Software Foundation; either | 9 | * License as published by the Free Software Foundation; either |
10 | * version 2 of the License, or (at your option) any later version. | 10 | * version 2 of the License, or (at your option) any later version. |
11 | * ===================================================================== | 11 | * ===================================================================== |
12 | * ===================================================================== | 12 | * ===================================================================== |
13 | * Version: $Id$ | 13 | * Version: $Id$ |
14 | * ===================================================================== | 14 | * ===================================================================== |
15 | * History: | 15 | * History: |
16 | * $Log$ | 16 | * $Log$ |
17 | * Revision 1.4 2004/03/14 13:50:35 alwin | ||
18 | * namespace correction | ||
19 | * | ||
17 | * Revision 1.3 2003/12/22 11:41:39 eilers | 20 | * Revision 1.3 2003/12/22 11:41:39 eilers |
18 | * Fixing stupid bug, found by sourcode review.. | 21 | * Fixing stupid bug, found by sourcode review.. |
19 | * | 22 | * |
20 | * Revision 1.2 2003/12/22 10:19:26 eilers | 23 | * Revision 1.2 2003/12/22 10:19:26 eilers |
21 | * Finishing implementation of sql-backend for datebook. But I have to | 24 | * Finishing implementation of sql-backend for datebook. But I have to |
22 | * port the PIM datebook application to use it, before I could debug the | 25 | * port the PIM datebook application to use it, before I could debug the |
23 | * whole stuff. | 26 | * whole stuff. |
24 | * Thus, PIM-Database backend is finished, but highly experimental. And some | 27 | * Thus, PIM-Database backend is finished, but highly experimental. And some |
@@ -45,16 +48,17 @@ | |||
45 | 48 | ||
46 | #include <opie2/osqldriver.h> | 49 | #include <opie2/osqldriver.h> |
47 | #include <opie2/osqlmanager.h> | 50 | #include <opie2/osqlmanager.h> |
48 | #include <opie2/osqlquery.h> | 51 | #include <opie2/osqlquery.h> |
49 | 52 | ||
50 | #include "orecur.h" | 53 | #include "orecur.h" |
51 | #include "odatebookaccessbackend_sql.h" | 54 | #include "odatebookaccessbackend_sql.h" |
52 | 55 | ||
56 | using namespace Opie::DB; | ||
53 | 57 | ||
54 | 58 | ||
55 | ODateBookAccessBackend_SQL::ODateBookAccessBackend_SQL( const QString& , | 59 | ODateBookAccessBackend_SQL::ODateBookAccessBackend_SQL( const QString& , |
56 | const QString& fileName ) | 60 | const QString& fileName ) |
57 | : ODateBookAccessBackend(), m_driver( NULL ) | 61 | : ODateBookAccessBackend(), m_driver( NULL ) |
58 | { | 62 | { |
59 | m_fileName = fileName.isEmpty() ? Global::applicationFileName( "datebook", "datebook.db" ) : fileName; | 63 | m_fileName = fileName.isEmpty() ? Global::applicationFileName( "datebook", "datebook.db" ) : fileName; |
60 | 64 | ||
diff --git a/libopie/pim/odatebookaccessbackend_sql.h b/libopie/pim/odatebookaccessbackend_sql.h index f39e154..ba514bc 100644 --- a/libopie/pim/odatebookaccessbackend_sql.h +++ b/libopie/pim/odatebookaccessbackend_sql.h | |||
@@ -1,18 +1,21 @@ | |||
1 | #ifndef OPIE_DATE_BOOK_ACCESS_BACKEND_SQL__H | 1 | #ifndef OPIE_DATE_BOOK_ACCESS_BACKEND_SQL__H |
2 | #define OPIE_DATE_BOOK_ACCESS_BACKEND_SQL__H | 2 | #define OPIE_DATE_BOOK_ACCESS_BACKEND_SQL__H |
3 | 3 | ||
4 | #include <qmap.h> | 4 | #include <qmap.h> |
5 | #include <opie2/osqlresult.h> | 5 | #include <opie2/osqlresult.h> |
6 | 6 | ||
7 | #include "odatebookaccessbackend.h" | 7 | #include "odatebookaccessbackend.h" |
8 | 8 | ||
9 | namespace Opie { namespace DB { | ||
9 | class OSQLDriver; | 10 | class OSQLDriver; |
10 | 11 | ||
12 | }} | ||
13 | |||
11 | /** | 14 | /** |
12 | * This is the default SQL implementation for DateBoook SQL storage | 15 | * This is the default SQL implementation for DateBoook SQL storage |
13 | * It fully implements the interface | 16 | * It fully implements the interface |
14 | * @see ODateBookAccessBackend | 17 | * @see ODateBookAccessBackend |
15 | * @see OPimAccessBackend | 18 | * @see OPimAccessBackend |
16 | */ | 19 | */ |
17 | class ODateBookAccessBackend_SQL : public ODateBookAccessBackend { | 20 | class ODateBookAccessBackend_SQL : public ODateBookAccessBackend { |
18 | public: | 21 | public: |
@@ -43,20 +46,20 @@ public: | |||
43 | private: | 46 | private: |
44 | bool loadFile(); | 47 | bool loadFile(); |
45 | QString m_fileName; | 48 | QString m_fileName; |
46 | QArray<int> m_uids; | 49 | QArray<int> m_uids; |
47 | 50 | ||
48 | QMap<int, QString> m_fieldMap; | 51 | QMap<int, QString> m_fieldMap; |
49 | QMap<QString, int> m_reverseFieldMap; | 52 | QMap<QString, int> m_reverseFieldMap; |
50 | 53 | ||
51 | OSQLDriver* m_driver; | 54 | Opie::DB::OSQLDriver* m_driver; |
52 | 55 | ||
53 | class Private; | 56 | class Private; |
54 | Private *d; | 57 | Private *d; |
55 | 58 | ||
56 | void initFields(); | 59 | void initFields(); |
57 | void update(); | 60 | void update(); |
58 | QArray<int> extractUids( OSQLResult& res ) const; | 61 | QArray<int> extractUids( Opie::DB::OSQLResult& res ) const; |
59 | 62 | ||
60 | }; | 63 | }; |
61 | 64 | ||
62 | #endif | 65 | #endif |
diff --git a/libopie/pim/otodoaccesssql.cpp b/libopie/pim/otodoaccesssql.cpp index 3764c7e..fd01a42 100644 --- a/libopie/pim/otodoaccesssql.cpp +++ b/libopie/pim/otodoaccesssql.cpp | |||
@@ -8,16 +8,17 @@ | |||
8 | #include <opie2/osqlmanager.h> | 8 | #include <opie2/osqlmanager.h> |
9 | #include <opie2/osqlquery.h> | 9 | #include <opie2/osqlquery.h> |
10 | 10 | ||
11 | #include "otodoaccesssql.h" | 11 | #include "otodoaccesssql.h" |
12 | #include "opimstate.h" | 12 | #include "opimstate.h" |
13 | #include "opimnotifymanager.h" | 13 | #include "opimnotifymanager.h" |
14 | #include "orecur.h" | 14 | #include "orecur.h" |
15 | 15 | ||
16 | using namespace Opie::DB; | ||
16 | /* | 17 | /* |
17 | * first some query | 18 | * first some query |
18 | * CREATE query | 19 | * CREATE query |
19 | * LOAD query | 20 | * LOAD query |
20 | * INSERT | 21 | * INSERT |
21 | * REMOVE | 22 | * REMOVE |
22 | * CLEAR | 23 | * CLEAR |
23 | */ | 24 | */ |
diff --git a/libopie/pim/otodoaccesssql.h b/libopie/pim/otodoaccesssql.h index 1c55567..72214de 100644 --- a/libopie/pim/otodoaccesssql.h +++ b/libopie/pim/otodoaccesssql.h | |||
@@ -1,18 +1,23 @@ | |||
1 | #ifndef OPIE_PIM_ACCESS_SQL_H | 1 | #ifndef OPIE_PIM_ACCESS_SQL_H |
2 | #define OPIE_PIM_ACCESS_SQL_H | 2 | #define OPIE_PIM_ACCESS_SQL_H |
3 | 3 | ||
4 | #include <qasciidict.h> | 4 | #include <qasciidict.h> |
5 | 5 | ||
6 | #include "otodoaccessbackend.h" | 6 | #include "otodoaccessbackend.h" |
7 | 7 | ||
8 | namespace Opie{ | ||
9 | namespace DB { | ||
8 | class OSQLDriver; | 10 | class OSQLDriver; |
9 | class OSQLResult; | 11 | class OSQLResult; |
10 | class OSQLResultItem; | 12 | class OSQLResultItem; |
13 | } | ||
14 | } | ||
15 | |||
11 | class OTodoAccessBackendSQL : public OTodoAccessBackend { | 16 | class OTodoAccessBackendSQL : public OTodoAccessBackend { |
12 | public: | 17 | public: |
13 | OTodoAccessBackendSQL( const QString& file ); | 18 | OTodoAccessBackendSQL( const QString& file ); |
14 | ~OTodoAccessBackendSQL(); | 19 | ~OTodoAccessBackendSQL(); |
15 | 20 | ||
16 | bool load(); | 21 | bool load(); |
17 | bool reload(); | 22 | bool reload(); |
18 | bool save(); | 23 | bool save(); |
@@ -35,22 +40,22 @@ public: | |||
35 | QArray<int> matchRegexp( const QRegExp &r ) const; | 40 | QArray<int> matchRegexp( const QRegExp &r ) const; |
36 | void removeAllCompleted(); | 41 | void removeAllCompleted(); |
37 | 42 | ||
38 | 43 | ||
39 | private: | 44 | private: |
40 | void update()const; | 45 | void update()const; |
41 | void fillDict(); | 46 | void fillDict(); |
42 | inline bool date( QDate& date, const QString& )const; | 47 | inline bool date( QDate& date, const QString& )const; |
43 | inline OTodo todo( const OSQLResult& )const; | 48 | inline OTodo todo( const Opie::DB::OSQLResult& )const; |
44 | inline OTodo todo( OSQLResultItem& )const; | 49 | inline OTodo todo( Opie::DB::OSQLResultItem& )const; |
45 | inline QArray<int> uids( const OSQLResult& )const; | 50 | inline QArray<int> uids( const Opie::DB::OSQLResult& )const; |
46 | OTodo todo( int uid )const; | 51 | OTodo todo( int uid )const; |
47 | QBitArray sup() const; | 52 | QBitArray sup() const; |
48 | 53 | ||
49 | QAsciiDict<int> m_dict; | 54 | QAsciiDict<int> m_dict; |
50 | OSQLDriver* m_driver; | 55 | Opie::DB::OSQLDriver* m_driver; |
51 | QArray<int> m_uids; | 56 | QArray<int> m_uids; |
52 | bool m_dirty : 1; | 57 | bool m_dirty : 1; |
53 | }; | 58 | }; |
54 | 59 | ||
55 | 60 | ||
56 | #endif | 61 | #endif |