summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/pim/opimaccessbackend.h16
-rw-r--r--libopie/pim/opimaccesstemplate.h7
-rw-r--r--libopie/pim/otodoaccesssql.cpp2
-rw-r--r--libopie2/opiepim/backend/opimaccessbackend.h16
-rw-r--r--libopie2/opiepim/backend/otodoaccesssql.cpp2
-rw-r--r--libopie2/opiepim/core/opimaccesstemplate.h7
6 files changed, 44 insertions, 6 deletions
diff --git a/libopie/pim/opimaccessbackend.h b/libopie/pim/opimaccessbackend.h
index 27d3cb8..0bd2723 100644
--- a/libopie/pim/opimaccessbackend.h
+++ b/libopie/pim/opimaccessbackend.h
@@ -83,6 +83,10 @@ public:
*/
void setFrontend( Frontend* front );
+ /**
+ * set the read ahead count
+ */
+ void setReadAhead( uint count );
protected:
void cache( const T& t )const;
@@ -91,8 +95,11 @@ protected:
*/
void setSaneCacheSize( int );
+ uint readAhead()const;
+
private:
Frontend* m_front;
+ uint m_read;
};
@@ -123,5 +130,12 @@ 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/libopie/pim/opimaccesstemplate.h b/libopie/pim/opimaccesstemplate.h
index 50cb1e4..c5523a8 100644
--- a/libopie/pim/opimaccesstemplate.h
+++ b/libopie/pim/opimaccesstemplate.h
@@ -65,7 +65,7 @@ public:
virtual List allRecords()const;
/**
- * queryByExample.
+ * queryByExample.
* @see otodoaccess, ocontactaccess
*/
virtual List queryByExample( const T& t, int querySettings );
@@ -116,6 +116,7 @@ public:
*/
virtual bool replace( const T& t) ;
+ void setReadAhead( uint count );
/**
* @internal
*/
@@ -251,4 +252,8 @@ 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
diff --git a/libopie/pim/otodoaccesssql.cpp b/libopie/pim/otodoaccesssql.cpp
index 9ef6b7c..8c2ea3a 100644
--- a/libopie/pim/otodoaccesssql.cpp
+++ b/libopie/pim/otodoaccesssql.cpp
@@ -286,9 +286,9 @@ OTodo OTodoAccessBackendSQL::find(int uid ) const{
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;
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
@@ -83,6 +83,10 @@ public:
*/
void setFrontend( Frontend* front );
+ /**
+ * set the read ahead count
+ */
+ void setReadAhead( uint count );
protected:
void cache( const T& t )const;
@@ -91,8 +95,11 @@ protected:
*/
void setSaneCacheSize( int );
+ uint readAhead()const;
+
private:
Frontend* m_front;
+ uint m_read;
};
@@ -123,5 +130,12 @@ 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
@@ -286,9 +286,9 @@ OTodo OTodoAccessBackendSQL::find(int uid ) const{
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;
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
@@ -65,7 +65,7 @@ public:
virtual List allRecords()const;
/**
- * queryByExample.
+ * queryByExample.
* @see otodoaccess, ocontactaccess
*/
virtual List queryByExample( const T& t, int querySettings );
@@ -116,6 +116,7 @@ public:
*/
virtual bool replace( const T& t) ;
+ void setReadAhead( uint count );
/**
* @internal
*/
@@ -251,4 +252,8 @@ 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