author | eilers <eilers> | 2003-12-08 15:18:10 (UTC) |
---|---|---|
committer | eilers <eilers> | 2003-12-08 15:18:10 (UTC) |
commit | 6974a4bbdc674a2a5d41d801f80035a183faedb5 (patch) (side-by-side diff) | |
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 @@ +#ifndef OPIE_DATE_BOOK_ACCESS_BACKEND_SQL__H +#define OPIE_DATE_BOOK_ACCESS_BACKEND_SQL__H + +#include <qmap.h> + +#include "odatebookaccessbackend.h" + +class OSQLDriver; + +/** + * This is the default SQL implementation for DateBoook SQL storage + * It fully implements the interface + * @see ODateBookAccessBackend + * @see OPimAccessBackend + */ +class ODateBookAccessBackend_SQL : public ODateBookAccessBackend { +public: + ODateBookAccessBackend_SQL( const QString& appName, + const QString& fileName = QString::null); + ~ODateBookAccessBackend_SQL(); + + bool load(); + bool reload(); + bool save(); + + QArray<int> allRecords()const; + QArray<int> matchRegexp(const QRegExp &r) const; + QArray<int> queryByExample( const OEvent&, int, const QDateTime& d = QDateTime() ); + OEvent find( int uid )const; + void clear(); + bool add( const OEvent& ev ); + bool remove( int uid ); + bool replace( const OEvent& ev ); + + QArray<UID> rawEvents()const; + QArray<UID> rawRepeats()const; + QArray<UID> nonRepeats()const; + + OEvent::ValueList directNonRepeats(); + OEvent::ValueList directRawRepeats(); + +private: + bool loadFile(); + QString m_fileName; + QArray<int> m_uids; + + QMap<int, QString> m_fieldMap; + + OSQLDriver* m_driver; + + class Private; + Private *d; + + void initFields(); + void update(); + QArray<int> extractUids( OSQLResult& res ) const; + +}; + +#endif |