From 549472ef07703ef27dc5f58a37e8f16c714fb2a1 Mon Sep 17 00:00:00 2001 From: zecke Date: Sat, 19 Oct 2002 00:08:35 +0000 Subject: Add void setReadAhead(uint) to the templates OTodoAccessSQL use the read ahead value --- (limited to 'libopie/pim') 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::find( int uid, const QArray&, uint, Frontend::CacheDirection )const { return find( uid ); } - +template +void OPimAccessBackend::setReadAhead( uint count ) { + m_read = count; +} +template +uint OPimAccessBackend::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 void OPimAccessTemplate::setSaneCacheSize( int size ) { m_cache.setSize( size ); } +template +void OPimAccessTemplate::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& ints, uint cur, Frontend::CacheDirection dir ) const{ + int CACHE = readAhead(); qWarning("searching for %d", uid ); QArray search( CACHE ); uint size =0; -- cgit v0.9.0.2