From e68537563c9950654b9a771730f0fc3890803a54 Mon Sep 17 00:00:00 2001 From: zecke Date: Mon, 07 Oct 2002 14:59:44 +0000 Subject: Fix sorted SQL query --- (limited to 'libopie/pim') diff --git a/libopie/pim/otodoaccesssql.cpp b/libopie/pim/otodoaccesssql.cpp index 25536e0..8add9f7 100644 --- a/libopie/pim/otodoaccesssql.cpp +++ b/libopie/pim/otodoaccesssql.cpp @@ -323,14 +323,16 @@ QArray OTodoAccessBackendSQL::sorted( bool asc, int sortOrder, */ /* Category */ if ( sortFilter & 1 ) { - query += " categories like '%" +QString::number(cat)+"%' AND"; + QString str; + if (cat != 0 ) str = QString::number( cat ); + query += " categories like '%" +str+"%' AND"; } /* Show only overdue */ if ( sortFilter & 2 ) { QDate date = QDate::currentDate(); QString due; QString base; - base = QString("DueDate <= '%1-%2-%3' AND WHERE completed = 0").arg( date.year() ).arg( date.month() ).arg( date.day() ); + base = QString("DueDate <= '%1-%2-%3' AND completed = 0").arg( date.year() ).arg( date.month() ).arg( date.day() ); query += " " + base + " AND"; } /* not show completed */ @@ -443,6 +445,7 @@ QArray OTodoAccessBackendSQL::uids( const OSQLResult& res) const{ OSQLResultItem::ValueList list = res.results(); OSQLResultItem::ValueList::Iterator it; QArray ints(list.count() ); + qWarning(" count = %d", list.count() ); int i = 0; for (it = list.begin(); it != list.end(); ++it ) { -- cgit v0.9.0.2