summaryrefslogtreecommitdiff
path: root/libopie/pim/otodoaccesssql.h
authorzecke <zecke>2002-10-07 09:10:05 (UTC)
committer zecke <zecke>2002-10-07 09:10:05 (UTC)
commitacd2d0062dd87635feb03927663b1f700305d67b (patch) (side-by-side diff)
tree179217749ec7ba3217ca71f80a6e1064f249d1b0 /libopie/pim/otodoaccesssql.h
parentde56dc7c5a21cbd70e9d1e66ab68ca95a277c45c (diff)
downloadopie-acd2d0062dd87635feb03927663b1f700305d67b.zip
opie-acd2d0062dd87635feb03927663b1f700305d67b.tar.gz
opie-acd2d0062dd87635feb03927663b1f700305d67b.tar.bz2
First SQL backend Resource
The DB layout is not fully what we've in mind but for example I do lack the Categories infrastructure for that I've to implement sorted lists and then I'll make Todolist fast
Diffstat (limited to 'libopie/pim/otodoaccesssql.h') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/pim/otodoaccesssql.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/libopie/pim/otodoaccesssql.h b/libopie/pim/otodoaccesssql.h
new file mode 100644
index 0000000..966628d
--- a/dev/null
+++ b/libopie/pim/otodoaccesssql.h
@@ -0,0 +1,46 @@
+#ifndef OPIE_PIM_ACCESS_SQL_H
+#define OPIE_PIM_ACCESS_SQL_H
+
+#include <qasciidict.h>
+
+#include "otodoaccessbackend.h"
+
+class OSQLDriver;
+class OSQLResult;
+class OTodoAccessBackendSQL : public OTodoAccessBackend {
+public:
+ OTodoAccessBackendSQL( const QString& file );
+ ~OTodoAccessBackendSQL();
+
+ bool load();
+ bool reload();
+ bool save();
+ QArray<int> allRecords()const;
+
+ QArray<int> queryByExample( const OTodo& t, int sort );
+ OTodo find(int uid)const;
+ void clear();
+ bool add( const OTodo& t );
+ bool remove( int uid );
+ bool replace( const OTodo& t );
+
+ QArray<int> overDue();
+ QArray<int> effectiveToDos( const QDate& start,
+ const QDate& end, bool includeNoDates );
+ QArray<int> sorted(bool asc, int sortOrder, int sortFilter, int cat );
+
+private:
+ void update();
+ void fillDict();
+ bool date( QDate& date, const QString& )const;
+ OTodo todo( const OSQLResult& )const;
+ QArray<int> uids( const OSQLResult& )const;
+ OTodo todo( int uid )const;
+
+ QAsciiDict<int> m_dict;
+ OSQLDriver* m_driver;
+ QArray<int> m_uids;
+};
+
+
+#endif