summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/backend/ocontactaccessbackend_sql.cpp20
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
@@ -304,9 +304,9 @@ namespace {
304 return single(); 304 return single();
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++ ) {
312 qu += " uid = " + QString::number( m_uids[i] ) + " OR"; 312 qu += " uid = " + QString::number( m_uids[i] ) + " OR";
@@ -319,9 +319,9 @@ namespace {
319 319
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 }
327 327
@@ -491,12 +491,12 @@ OPimContact OPimContactAccessBackend_SQL::find( int uid, const QArray<int>& quer
491 odebug << "searching for " << uid << "" << oendl; 491 odebug << "searching for " << uid << "" << oendl;
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
502 // We will just request "numReadAhead" elements, starting from "current" position in 502 // We will just request "numReadAhead" elements, starting from "current" position in
@@ -623,8 +623,10 @@ QArray<int> OPimContactAccessBackend_SQL::queryByExample ( const OPimContact &qu
623 + queryStr + "'" + ")"; 623 + queryStr + "'" + ")";
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 )
630// qu = qu.left( qu.length() - 4 ); 632// qu = qu.left( qu.length() - 4 );
@@ -824,24 +826,24 @@ QMap<int, QString> OPimContactAccessBackend_SQL::requestNonCustom( int uid ) co
824 QTime t3; 826 QTime t3;
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
832 << " ms, mapping: " << t3needed << " ms" << oendl; 834 << " ms, mapping: " << t3needed << " ms" << oendl;
833 835
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 */
838OPimContact OPimContactAccessBackend_SQL::requestContactsAndCache( int uid, const QArray<int>& uidlist )const 840OPimContact 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
847 odebug << "Reqest and cache" << cachelist.size() << "elements !" << oendl; 849 odebug << "Reqest and cache" << cachelist.size() << "elements !" << oendl;
@@ -870,14 +872,14 @@ OPimContact OPimContactAccessBackend_SQL::requestContactsAndCache( int uid, cons
870 retContact = contact; 872 retContact = contact;
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
883QMap<int, QString> OPimContactAccessBackend_SQL::fillNonCustomMap( const OSQLResultItem& resultItem ) const 885QMap<int, QString> OPimContactAccessBackend_SQL::fillNonCustomMap( const OSQLResultItem& resultItem ) const