summaryrefslogtreecommitdiff
path: root/libopie
authorzecke <zecke>2002-10-07 14:59:44 (UTC)
committer zecke <zecke>2002-10-07 14:59:44 (UTC)
commite68537563c9950654b9a771730f0fc3890803a54 (patch) (unidiff)
treefd64fada00405ca8ad65e9334bcdb4c3da3f1a9a /libopie
parent645b377506fb32f4519e70d43c020084943debae (diff)
downloadopie-e68537563c9950654b9a771730f0fc3890803a54.zip
opie-e68537563c9950654b9a771730f0fc3890803a54.tar.gz
opie-e68537563c9950654b9a771730f0fc3890803a54.tar.bz2
Fix sorted SQL query
Diffstat (limited to 'libopie') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/pim/otodoaccesssql.cpp7
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
@@ -323,14 +323,16 @@ QArray<int> OTodoAccessBackendSQL::sorted( bool asc, int sortOrder,
323 */ 323 */
324 /* Category */ 324 /* Category */
325 if ( sortFilter & 1 ) { 325 if ( sortFilter & 1 ) {
326 query += " categories like '%" +QString::number(cat)+"%' AND"; 326 QString str;
327 if (cat != 0 ) str = QString::number( cat );
328 query += " categories like '%" +str+"%' AND";
327 } 329 }
328 /* Show only overdue */ 330 /* Show only overdue */
329 if ( sortFilter & 2 ) { 331 if ( sortFilter & 2 ) {
330 QDate date = QDate::currentDate(); 332 QDate date = QDate::currentDate();
331 QString due; 333 QString due;
332 QString base; 334 QString base;
333 base = QString("DueDate <= '%1-%2-%3' AND WHERE completed = 0").arg( date.year() ).arg( date.month() ).arg( date.day() ); 335 base = QString("DueDate <= '%1-%2-%3' AND completed = 0").arg( date.year() ).arg( date.month() ).arg( date.day() );
334 query += " " + base + " AND"; 336 query += " " + base + " AND";
335 } 337 }
336 /* not show completed */ 338 /* not show completed */
@@ -443,6 +445,7 @@ QArray<int> OTodoAccessBackendSQL::uids( const OSQLResult& res) const{
443 OSQLResultItem::ValueList list = res.results(); 445 OSQLResultItem::ValueList list = res.results();
444 OSQLResultItem::ValueList::Iterator it; 446 OSQLResultItem::ValueList::Iterator it;
445 QArray<int> ints(list.count() ); 447 QArray<int> ints(list.count() );
448 qWarning(" count = %d", list.count() );
446 449
447 int i = 0; 450 int i = 0;
448 for (it = list.begin(); it != list.end(); ++it ) { 451 for (it = list.begin(); it != list.end(); ++it ) {