summaryrefslogtreecommitdiff
path: root/libopie2/opiepim
authorzecke <zecke>2002-10-19 00:08:35 (UTC)
committer zecke <zecke>2002-10-19 00:08:35 (UTC)
commit549472ef07703ef27dc5f58a37e8f16c714fb2a1 (patch) (side-by-side diff)
tree9742f2545ef3504e61a07cef2996aa29b9db5b90 /libopie2/opiepim
parent598cfa66b57d61e15bc3c5ea3a9c8e7295864455 (diff)
downloadopie-549472ef07703ef27dc5f58a37e8f16c714fb2a1.zip
opie-549472ef07703ef27dc5f58a37e8f16c714fb2a1.tar.gz
opie-549472ef07703ef27dc5f58a37e8f16c714fb2a1.tar.bz2
Add void setReadAhead(uint) to the templates
OTodoAccessSQL use the read ahead value
Diffstat (limited to 'libopie2/opiepim') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/backend/opimaccessbackend.h16
-rw-r--r--libopie2/opiepim/backend/otodoaccesssql.cpp2
-rw-r--r--libopie2/opiepim/core/opimaccesstemplate.h7
3 files changed, 22 insertions, 3 deletions
diff --git a/libopie2/opiepim/backend/opimaccessbackend.h b/libopie2/opiepim/backend/opimaccessbackend.h
index 27d3cb8..0bd2723 100644
--- a/libopie2/opiepim/backend/opimaccessbackend.h
+++ b/libopie2/opiepim/backend/opimaccessbackend.h
@@ -80,22 +80,29 @@ public:
/*
* setTheFrontEnd!!!
*/
void setFrontend( Frontend* front );
+ /**
+ * set the read ahead count
+ */
+ void setReadAhead( uint count );
protected:
void cache( const T& t )const;
/**
* use a prime number here!
*/
void setSaneCacheSize( int );
+ uint readAhead()const;
+
private:
Frontend* m_front;
+ uint m_read;
};
template <class T>
OPimAccessBackend<T>::OPimAccessBackend() {
m_front = 0l;
@@ -120,8 +127,15 @@ void OPimAccessBackend<T>::setSaneCacheSize( int size) {
}
template <class T>
T OPimAccessBackend<T>::find( int uid, const QArray<int>&,
uint, Frontend::CacheDirection )const {
return find( uid );
}
-
+template <class T>
+void OPimAccessBackend<T>::setReadAhead( uint count ) {
+ m_read = count;
+}
+template <class T>
+uint OPimAccessBackend<T>::readAhead()const {
+ return m_read;
+}
#endif
diff --git a/libopie2/opiepim/backend/otodoaccesssql.cpp b/libopie2/opiepim/backend/otodoaccesssql.cpp
index 9ef6b7c..8c2ea3a 100644
--- a/libopie2/opiepim/backend/otodoaccesssql.cpp
+++ b/libopie2/opiepim/backend/otodoaccesssql.cpp
@@ -283,15 +283,15 @@ QArray<int> OTodoAccessBackendSQL::queryByExample( const OTodo& , int ){
}
OTodo OTodoAccessBackendSQL::find(int uid ) const{
FindQuery query( uid );
return todo( m_driver->query(&query) );
}
-#define CACHE 32
OTodo OTodoAccessBackendSQL::find( int uid, const QArray<int>& ints,
uint cur, Frontend::CacheDirection dir ) const{
+ int CACHE = readAhead();
qWarning("searching for %d", uid );
QArray<int> search( CACHE );
uint size =0;
OTodo to;
// we try to cache CACHE items
diff --git a/libopie2/opiepim/core/opimaccesstemplate.h b/libopie2/opiepim/core/opimaccesstemplate.h
index 50cb1e4..c5523a8 100644
--- a/libopie2/opiepim/core/opimaccesstemplate.h
+++ b/libopie2/opiepim/core/opimaccesstemplate.h
@@ -62,13 +62,13 @@ public:
* return a List of records
* you can iterate over them
*/
virtual List allRecords()const;
/**
- * queryByExample.
+ * queryByExample.
* @see otodoaccess, ocontactaccess
*/
virtual List queryByExample( const T& t, int querySettings );
/**
* find the OPimRecord uid
@@ -113,12 +113,13 @@ public:
* replace T from backend
* @param t The item to replace
* @return <i>true</i> if successful.
*/
virtual bool replace( const T& t) ;
+ void setReadAhead( uint count );
/**
* @internal
*/
void cache( const T& )const;
void setSaneCacheSize( int );
protected:
@@ -248,7 +249,11 @@ void OPimAccessTemplate<T>::cache( const T& t ) const{
((OPimAccessTemplate<T>*)this)->m_cache.add( t );
}
template <class T>
void OPimAccessTemplate<T>::setSaneCacheSize( int size ) {
m_cache.setSize( size );
}
+template <class T>
+void OPimAccessTemplate<T>::setReadAhead( uint count ) {
+ m_backEnd->setReadAhead( count );
+}
#endif