summaryrefslogtreecommitdiff
authoreilers <eilers>2004-08-29 12:48:43 (UTC)
committer eilers <eilers>2004-08-29 12:48:43 (UTC)
commit45327ef3c0f093fc227682f79158632afc09e6d1 (patch) (side-by-side diff)
treebdfe4e602abcef87117528d2c9c4166820488d11
parentdd159675e6e3c361bc20eaa6994265e73b6599ef (diff)
downloadopie-45327ef3c0f093fc227682f79158632afc09e6d1.zip
opie-45327ef3c0f093fc227682f79158632afc09e6d1.tar.gz
opie-45327ef3c0f093fc227682f79158632afc09e6d1.tar.bz2
Fixed some quirks..
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/backend/otodoaccesssql.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/libopie2/opiepim/backend/otodoaccesssql.cpp b/libopie2/opiepim/backend/otodoaccesssql.cpp
index 6f65c48..12a8bea 100644
--- a/libopie2/opiepim/backend/otodoaccesssql.cpp
+++ b/libopie2/opiepim/backend/otodoaccesssql.cpp
@@ -457,6 +457,8 @@ OPimTodo OPimTodoAccessBackendSQL::find(int uid ) const{
return todo( m_driver->query(&query) );
}
+
+// Remember: uid is already in the list of uids, called ints !
OPimTodo OPimTodoAccessBackendSQL::find( int uid, const QArray<int>& ints,
uint cur, Frontend::CacheDirection dir ) const{
uint CACHE = readAhead();
@@ -468,7 +470,7 @@ OPimTodo OPimTodoAccessBackendSQL::find( int uid, const QArray<int>& ints,
// we try to cache CACHE items
switch( dir ) {
/* forward */
- case 0: // FIXME: Not a good style to use magic numbers here (eilers)
+ case Frontend::Forward:
for (uint i = cur; i < ints.count() && size < CACHE; i++ ) {
odebug << "size " << size << " " << ints[i] << "" << oendl;
search[size] = ints[i];
@@ -476,21 +478,24 @@ OPimTodo OPimTodoAccessBackendSQL::find( int uid, const QArray<int>& ints,
}
break;
/* reverse */
- case 1: // FIXME: Not a good style to use magic numbers here (eilers)
+ case Frontend::Reverse:
for (uint i = cur; i != 0 && size < CACHE; i-- ) {
search[size] = ints[i];
size++;
}
break;
}
+
search.resize( size );
FindQuery query( search );
OSQLResult res = m_driver->query( &query );
if ( res.state() != OSQLResult::Success )
return to;
- return todo( res );
+ todo( res ); //FIXME: Don't like polymorphism here. It makes the code hard to read here..(eilers)
+ return cacheFind( uid );
}
+
void OPimTodoAccessBackendSQL::clear() {
ClearQuery cle;
OSQLResult res = m_driver->query( &cle );