summaryrefslogtreecommitdiff
Unidiff
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:
83 */ 83 */
84 void setFrontend( Frontend* front ); 84 void setFrontend( Frontend* front );
85 85
86 /**
87 * set the read ahead count
88 */
89 void setReadAhead( uint count );
86protected: 90protected:
87 void cache( const T& t )const; 91 void cache( const T& t )const;
88 92
@@ -91,8 +95,11 @@ protected:
91 */ 95 */
92 void setSaneCacheSize( int ); 96 void setSaneCacheSize( int );
93 97
98 uint readAhead()const;
99
94private: 100private:
95 Frontend* m_front; 101 Frontend* m_front;
102 uint m_read;
96 103
97}; 104};
98 105
@@ -123,5 +130,12 @@ T OPimAccessBackend<T>::find( int uid, const QArray<int>&,
123 uint, Frontend::CacheDirection )const { 130 uint, Frontend::CacheDirection )const {
124 return find( uid ); 131 return find( uid );
125} 132}
126 133template <class T>
134void OPimAccessBackend<T>::setReadAhead( uint count ) {
135 m_read = count;
136}
137template <class T>
138uint OPimAccessBackend<T>::readAhead()const {
139 return m_read;
140}
127#endif 141#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:
65 virtual List allRecords()const; 65 virtual List allRecords()const;
66 66
67 /** 67 /**
68 * queryByExample. 68 * queryByExample.
69 * @see otodoaccess, ocontactaccess 69 * @see otodoaccess, ocontactaccess
70 */ 70 */
71 virtual List queryByExample( const T& t, int querySettings ); 71 virtual List queryByExample( const T& t, int querySettings );
@@ -116,6 +116,7 @@ public:
116 */ 116 */
117 virtual bool replace( const T& t) ; 117 virtual bool replace( const T& t) ;
118 118
119 void setReadAhead( uint count );
119 /** 120 /**
120 * @internal 121 * @internal
121 */ 122 */
@@ -251,4 +252,8 @@ template <class T>
251void OPimAccessTemplate<T>::setSaneCacheSize( int size ) { 252void OPimAccessTemplate<T>::setSaneCacheSize( int size ) {
252 m_cache.setSize( size ); 253 m_cache.setSize( size );
253} 254}
255template <class T>
256void OPimAccessTemplate<T>::setReadAhead( uint count ) {
257 m_backEnd->setReadAhead( count );
258}
254#endif 259#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{
286 return todo( m_driver->query(&query) ); 286 return todo( m_driver->query(&query) );
287 287
288} 288}
289#define CACHE 32
290OTodo OTodoAccessBackendSQL::find( int uid, const QArray<int>& ints, 289OTodo OTodoAccessBackendSQL::find( int uid, const QArray<int>& ints,
291 uint cur, Frontend::CacheDirection dir ) const{ 290 uint cur, Frontend::CacheDirection dir ) const{
291 int CACHE = readAhead();
292 qWarning("searching for %d", uid ); 292 qWarning("searching for %d", uid );
293 QArray<int> search( CACHE ); 293 QArray<int> search( CACHE );
294 uint size =0; 294 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:
83 */ 83 */
84 void setFrontend( Frontend* front ); 84 void setFrontend( Frontend* front );
85 85
86 /**
87 * set the read ahead count
88 */
89 void setReadAhead( uint count );
86protected: 90protected:
87 void cache( const T& t )const; 91 void cache( const T& t )const;
88 92
@@ -91,8 +95,11 @@ protected:
91 */ 95 */
92 void setSaneCacheSize( int ); 96 void setSaneCacheSize( int );
93 97
98 uint readAhead()const;
99
94private: 100private:
95 Frontend* m_front; 101 Frontend* m_front;
102 uint m_read;
96 103
97}; 104};
98 105
@@ -123,5 +130,12 @@ T OPimAccessBackend<T>::find( int uid, const QArray<int>&,
123 uint, Frontend::CacheDirection )const { 130 uint, Frontend::CacheDirection )const {
124 return find( uid ); 131 return find( uid );
125} 132}
126 133template <class T>
134void OPimAccessBackend<T>::setReadAhead( uint count ) {
135 m_read = count;
136}
137template <class T>
138uint OPimAccessBackend<T>::readAhead()const {
139 return m_read;
140}
127#endif 141#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{
286 return todo( m_driver->query(&query) ); 286 return todo( m_driver->query(&query) );
287 287
288} 288}
289#define CACHE 32
290OTodo OTodoAccessBackendSQL::find( int uid, const QArray<int>& ints, 289OTodo OTodoAccessBackendSQL::find( int uid, const QArray<int>& ints,
291 uint cur, Frontend::CacheDirection dir ) const{ 290 uint cur, Frontend::CacheDirection dir ) const{
291 int CACHE = readAhead();
292 qWarning("searching for %d", uid ); 292 qWarning("searching for %d", uid );
293 QArray<int> search( CACHE ); 293 QArray<int> search( CACHE );
294 uint size =0; 294 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:
65 virtual List allRecords()const; 65 virtual List allRecords()const;
66 66
67 /** 67 /**
68 * queryByExample. 68 * queryByExample.
69 * @see otodoaccess, ocontactaccess 69 * @see otodoaccess, ocontactaccess
70 */ 70 */
71 virtual List queryByExample( const T& t, int querySettings ); 71 virtual List queryByExample( const T& t, int querySettings );
@@ -116,6 +116,7 @@ public:
116 */ 116 */
117 virtual bool replace( const T& t) ; 117 virtual bool replace( const T& t) ;
118 118
119 void setReadAhead( uint count );
119 /** 120 /**
120 * @internal 121 * @internal
121 */ 122 */
@@ -251,4 +252,8 @@ template <class T>
251void OPimAccessTemplate<T>::setSaneCacheSize( int size ) { 252void OPimAccessTemplate<T>::setSaneCacheSize( int size ) {
252 m_cache.setSize( size ); 253 m_cache.setSize( size );
253} 254}
255template <class T>
256void OPimAccessTemplate<T>::setReadAhead( uint count ) {
257 m_backEnd->setReadAhead( count );
258}
254#endif 259#endif