author | zecke <zecke> | 2002-10-07 14:59:44 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-10-07 14:59:44 (UTC) |
commit | e68537563c9950654b9a771730f0fc3890803a54 (patch) (side-by-side diff) | |
tree | fd64fada00405ca8ad65e9334bcdb4c3da3f1a9a /libopie/pim | |
parent | 645b377506fb32f4519e70d43c020084943debae (diff) | |
download | opie-e68537563c9950654b9a771730f0fc3890803a54.zip opie-e68537563c9950654b9a771730f0fc3890803a54.tar.gz opie-e68537563c9950654b9a771730f0fc3890803a54.tar.bz2 |
Fix sorted SQL query
-rw-r--r-- | libopie/pim/otodoaccesssql.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
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 @@ -322,16 +322,18 @@ QArray<int> 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 */ if ( sortFilter & 4 ) { @@ -442,8 +444,9 @@ QArray<int> OTodoAccessBackendSQL::uids( const OSQLResult& res) const{ OSQLResultItem::ValueList list = res.results(); OSQLResultItem::ValueList::Iterator it; QArray<int> ints(list.count() ); + qWarning(" count = %d", list.count() ); int i = 0; for (it = list.begin(); it != list.end(); ++it ) { ints[i] = (*it).data("uid").toInt(); |