-rw-r--r-- | libopie2/opiepim/backend/ocontactaccessbackend_sql.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/libopie2/opiepim/backend/ocontactaccessbackend_sql.cpp b/libopie2/opiepim/backend/ocontactaccessbackend_sql.cpp index 221e977..3d284f7 100644 --- a/libopie2/opiepim/backend/ocontactaccessbackend_sql.cpp +++ b/libopie2/opiepim/backend/ocontactaccessbackend_sql.cpp | |||
@@ -305,7 +305,7 @@ namespace { | |||
305 | else | 305 | else |
306 | return multi(); | 306 | return multi(); |
307 | } | 307 | } |
308 | 308 | ||
309 | QString FindQuery::multi()const { | 309 | QString FindQuery::multi()const { |
310 | QString qu = "select * from addressbook where"; | 310 | QString qu = "select * from addressbook where"; |
311 | for (uint i = 0; i < m_uids.count(); i++ ) { | 311 | for (uint i = 0; i < m_uids.count(); i++ ) { |
@@ -320,7 +320,7 @@ namespace { | |||
320 | QString FindQuery::single()const{ | 320 | QString FindQuery::single()const{ |
321 | QString qu = "select *"; | 321 | QString qu = "select *"; |
322 | qu += " from addressbook where uid = " + QString::number(m_uid); | 322 | qu += " from addressbook where uid = " + QString::number(m_uid); |
323 | 323 | ||
324 | // owarn << "find query: " << qu << "" << oendl; | 324 | // owarn << "find query: " << qu << "" << oendl; |
325 | return qu; | 325 | return qu; |
326 | } | 326 | } |
@@ -492,10 +492,10 @@ OPimContact OPimContactAccessBackend_SQL::find( int uid, const QArray<int>& quer | |||
492 | 492 | ||
493 | QTime t; | 493 | QTime t; |
494 | t.start(); | 494 | t.start(); |
495 | 495 | ||
496 | uint numReadAhead = readAhead(); | 496 | uint numReadAhead = readAhead(); |
497 | QArray<int> searchList( numReadAhead ); | 497 | QArray<int> searchList( numReadAhead ); |
498 | 498 | ||
499 | uint size =0; | 499 | uint size =0; |
500 | 500 | ||
501 | // Build an array with all elements which should be requested and cached | 501 | // Build an array with all elements which should be requested and cached |
@@ -624,6 +624,8 @@ QArray<int> OPimContactAccessBackend_SQL::queryByExample ( const OPimContact &qu | |||
624 | 624 | ||
625 | } | 625 | } |
626 | } | 626 | } |
627 | |||
628 | delete endDate; | ||
627 | } | 629 | } |
628 | // Skip trailing "AND" | 630 | // Skip trailing "AND" |
629 | // if ( isAnyFieldSelected ) | 631 | // if ( isAnyFieldSelected ) |
@@ -825,7 +827,7 @@ QMap<int, QString> OPimContactAccessBackend_SQL::requestNonCustom( int uid ) co | |||
825 | t3.start(); | 827 | t3.start(); |
826 | nonCustomMap = fillNonCustomMap( resItem ); | 828 | nonCustomMap = fillNonCustomMap( resItem ); |
827 | t3needed = t3.elapsed(); | 829 | t3needed = t3.elapsed(); |
828 | 830 | ||
829 | 831 | ||
830 | // odebug << "Adding UID: " << resItem.data( "uid" ) << "" << oendl; | 832 | // odebug << "Adding UID: " << resItem.data( "uid" ) << "" << oendl; |
831 | odebug << "RequestNonCustom needed: insg.:" << t.elapsed() << " ms, query: " << t2needed | 833 | odebug << "RequestNonCustom needed: insg.:" << t.elapsed() << " ms, query: " << t2needed |
@@ -834,13 +836,13 @@ QMap<int, QString> OPimContactAccessBackend_SQL::requestNonCustom( int uid ) co | |||
834 | return nonCustomMap; | 836 | return nonCustomMap; |
835 | } | 837 | } |
836 | 838 | ||
837 | /* Returns contact requested by uid and fills cache with contacts requested by uids in the cachelist */ | 839 | /* Returns contact requested by uid and fills cache with contacts requested by uids in the cachelist */ |
838 | OPimContact OPimContactAccessBackend_SQL::requestContactsAndCache( int uid, const QArray<int>& uidlist )const | 840 | OPimContact OPimContactAccessBackend_SQL::requestContactsAndCache( int uid, const QArray<int>& uidlist )const |
839 | { | 841 | { |
840 | // We want to get all contacts with one query. | 842 | // 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). | 843 | // 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 | 844 | // All contacts will be stored in the cache, afterwards the contact with the user id "uid" will be returned |
843 | // by using the cache.. | 845 | // by using the cache.. |
844 | QArray<int> cachelist = uidlist; | 846 | QArray<int> cachelist = uidlist; |
845 | OPimContact retContact; | 847 | OPimContact retContact; |
846 | 848 | ||
@@ -871,12 +873,12 @@ OPimContact OPimContactAccessBackend_SQL::requestContactsAndCache( int uid, cons | |||
871 | resItem = res_noncustom.next(); | 873 | resItem = res_noncustom.next(); |
872 | } while ( ! res_noncustom.atEnd() ); //atEnd() is true if we are past(!) the list !! | 874 | } while ( ! res_noncustom.atEnd() ); //atEnd() is true if we are past(!) the list !! |
873 | t3needed = t3.elapsed(); | 875 | t3needed = t3.elapsed(); |
874 | 876 | ||
875 | 877 | ||
876 | // odebug << "Adding UID: " << resItem.data( "uid" ) << "" << oendl; | 878 | // odebug << "Adding UID: " << resItem.data( "uid" ) << "" << oendl; |
877 | odebug << "RequestContactsAndCache needed: insg.:" << t.elapsed() << " ms, query: " << t2needed | 879 | odebug << "RequestContactsAndCache needed: insg.:" << t.elapsed() << " ms, query: " << t2needed |
878 | << " ms, mapping: " << t3needed << " ms" << oendl; | 880 | << " ms, mapping: " << t3needed << " ms" << oendl; |
879 | 881 | ||
880 | return retContact; | 882 | return retContact; |
881 | } | 883 | } |
882 | 884 | ||