Diffstat (limited to 'libopie2/opiepim/backend/ocontactaccessbackend_sql.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opiepim/backend/ocontactaccessbackend_sql.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libopie2/opiepim/backend/ocontactaccessbackend_sql.cpp b/libopie2/opiepim/backend/ocontactaccessbackend_sql.cpp index abfd944..221e977 100644 --- a/libopie2/opiepim/backend/ocontactaccessbackend_sql.cpp +++ b/libopie2/opiepim/backend/ocontactaccessbackend_sql.cpp | |||
@@ -839,12 +839,13 @@ OPimContact OPimContactAccessBackend_SQL::requestContactsAndCache( int uid, cons | |||
839 | { | 839 | { |
840 | // We want to get all contacts with one query. | 840 | // We want to get all contacts with one query. |
841 | // We don't have to add the given uid to the uidlist, it is expected to be there already (see opimrecordlist.h). | 841 | // We don't have to add the given uid to the uidlist, it is expected to be there already (see opimrecordlist.h). |
842 | // All contacts will be stored in the cache, afterwards the contact with the user id "uid" will be returned | 842 | // All contacts will be stored in the cache, afterwards the contact with the user id "uid" will be returned |
843 | // by using the cache.. | 843 | // by using the cache.. |
844 | QArray<int> cachelist = uidlist; | 844 | QArray<int> cachelist = uidlist; |
845 | OPimContact retContact; | ||
845 | 846 | ||
846 | odebug << "Reqest and cache" << cachelist.size() << "elements !" << oendl; | 847 | odebug << "Reqest and cache" << cachelist.size() << "elements !" << oendl; |
847 | 848 | ||
848 | QTime t; | 849 | QTime t; |
849 | t.start(); | 850 | t.start(); |
850 | 851 | ||
@@ -862,22 +863,24 @@ OPimContact OPimContactAccessBackend_SQL::requestContactsAndCache( int uid, cons | |||
862 | OSQLResultItem resItem = res_noncustom.first(); | 863 | OSQLResultItem resItem = res_noncustom.first(); |
863 | do { | 864 | do { |
864 | OPimContact contact( fillNonCustomMap( resItem ) ); | 865 | OPimContact contact( fillNonCustomMap( resItem ) ); |
865 | contact.setExtraMap( requestCustom( contact.uid() ) ); | 866 | contact.setExtraMap( requestCustom( contact.uid() ) ); |
866 | odebug << "Caching uid: " << contact.uid() << oendl; | 867 | odebug << "Caching uid: " << contact.uid() << oendl; |
867 | cache( contact ); | 868 | cache( contact ); |
869 | if ( contact.uid() == uid ) | ||
870 | retContact = contact; | ||
868 | resItem = res_noncustom.next(); | 871 | resItem = res_noncustom.next(); |
869 | } while ( ! res_noncustom.atEnd() ); //atEnd() is true if we are past(!) the list !! | 872 | } while ( ! res_noncustom.atEnd() ); //atEnd() is true if we are past(!) the list !! |
870 | t3needed = t3.elapsed(); | 873 | t3needed = t3.elapsed(); |
871 | 874 | ||
872 | 875 | ||
873 | // odebug << "Adding UID: " << resItem.data( "uid" ) << "" << oendl; | 876 | // odebug << "Adding UID: " << resItem.data( "uid" ) << "" << oendl; |
874 | odebug << "RequestContactsAndCache needed: insg.:" << t.elapsed() << " ms, query: " << t2needed | 877 | odebug << "RequestContactsAndCache needed: insg.:" << t.elapsed() << " ms, query: " << t2needed |
875 | << " ms, mapping: " << t3needed << " ms" << oendl; | 878 | << " ms, mapping: " << t3needed << " ms" << oendl; |
876 | 879 | ||
877 | return cacheFind( uid ); | 880 | return retContact; |
878 | } | 881 | } |
879 | 882 | ||
880 | QMap<int, QString> OPimContactAccessBackend_SQL::fillNonCustomMap( const OSQLResultItem& resultItem ) const | 883 | QMap<int, QString> OPimContactAccessBackend_SQL::fillNonCustomMap( const OSQLResultItem& resultItem ) const |
881 | { | 884 | { |
882 | QMap<int, QString> nonCustomMap; | 885 | QMap<int, QString> nonCustomMap; |
883 | 886 | ||