odatebookaccessbackend_sql.h
Go to the documentation of this file.00001 #ifndef OPIE_DATE_BOOK_ACCESS_BACKEND_SQL__H 00002 #define OPIE_DATE_BOOK_ACCESS_BACKEND_SQL__H 00003 00004 #include <qmap.h> 00005 #include <opie2/osqlresult.h> 00006 00007 #include "odatebookaccessbackend.h" 00008 00009 class OSQLDriver; 00010 00017 class ODateBookAccessBackend_SQL : public ODateBookAccessBackend { 00018 public: 00019 ODateBookAccessBackend_SQL( const QString& appName, 00020 const QString& fileName = QString::null); 00021 ~ODateBookAccessBackend_SQL(); 00022 00023 bool load(); 00024 bool reload(); 00025 bool save(); 00026 00027 QArray<int> allRecords()const; 00028 QArray<int> matchRegexp(const QRegExp &r) const; 00029 QArray<int> queryByExample( const OEvent&, int, const QDateTime& d = QDateTime() ); 00030 OEvent find( int uid )const; 00031 void clear(); 00032 bool add( const OEvent& ev ); 00033 bool remove( int uid ); 00034 bool replace( const OEvent& ev ); 00035 00036 QArray<UID> rawEvents()const; 00037 QArray<UID> rawRepeats()const; 00038 QArray<UID> nonRepeats()const; 00039 00040 OEvent::ValueList directNonRepeats(); 00041 OEvent::ValueList directRawRepeats(); 00042 00043 private: 00044 bool loadFile(); 00045 QString m_fileName; 00046 QArray<int> m_uids; 00047 00048 QMap<int, QString> m_fieldMap; 00049 QMap<QString, int> m_reverseFieldMap; 00050 00051 OSQLDriver* m_driver; 00052 00053 class Private; 00054 Private *d; 00055 00056 void initFields(); 00057 void update(); 00058 QArray<int> extractUids( OSQLResult& res ) const; 00059 00060 }; 00061 00062 #endif
