Diffstat (limited to 'libopie2/opiepim/backend/ocontactaccessbackend_sql.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | libopie2/opiepim/backend/ocontactaccessbackend_sql.cpp | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/libopie2/opiepim/backend/ocontactaccessbackend_sql.cpp b/libopie2/opiepim/backend/ocontactaccessbackend_sql.cpp index 9375f43..2368865 100644 --- a/libopie2/opiepim/backend/ocontactaccessbackend_sql.cpp +++ b/libopie2/opiepim/backend/ocontactaccessbackend_sql.cpp @@ -281,3 +281,5 @@ namespace { : OSQLQuery(), m_uid( uid ) {} + RemoveQuery::~RemoveQuery() {} + QString RemoveQuery::query()const { @@ -291,4 +293,2 @@ namespace { - - FindQuery::FindQuery(int uid) @@ -308,2 +308,4 @@ namespace { + + QString FindQuery::multi()const { @@ -530,3 +532,3 @@ OPimContact OPimContactAccessBackend_SQL::find( int uid, const UIDArray& queryUi -UIDArray OPimContactAccessBackend_SQL::queryByExample ( const OPimContact &query, int settings, +UIDArray OPimContactAccessBackend_SQL::queryByExample ( const UIDArray& uidlist, const OPimContact &query, int settings, const QDateTime& qd ) const @@ -534,2 +536,15 @@ UIDArray OPimContactAccessBackend_SQL::queryByExample ( const OPimContact &query QString qu = "SELECT uid FROM addressbook WHERE"; + + // Just add uid's selection if we really try to search in a subset of all uids! Otherwise this would + // just take time and memory! + if ( uidlist.count() != m_uids.count() ) { + qu += " ("; + + for ( uint i = 0; i < uidlist.count(); i++ ) { + qu += " uid = " + QString::number( uidlist[i] ) + " OR"; + } + qu.remove( qu.length()-2, 2 ); // Hmmmm.. + qu += " ) AND "; + } + QString searchQuery =""; |