summaryrefslogtreecommitdiff
path: root/libopie2
Side-by-side diff
Diffstat (limited to 'libopie2') (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
@@ -302,13 +302,13 @@ namespace {
QString FindQuery::query()const{
if ( m_uids.count() == 0 )
return single();
else
return multi();
}
-
+
QString FindQuery::multi()const {
QString qu = "select * from addressbook where";
for (uint i = 0; i < m_uids.count(); i++ ) {
qu += " uid = " + QString::number( m_uids[i] ) + " OR";
}
qu.remove( qu.length()-2, 2 ); // Hmmmm..
@@ -317,13 +317,13 @@ namespace {
return qu;
}
QString FindQuery::single()const{
QString qu = "select *";
qu += " from addressbook where uid = " + QString::number(m_uid);
-
+
// owarn << "find query: " << qu << "" << oendl;
return qu;
}
FindCustomQuery::FindCustomQuery(int uid)
@@ -489,16 +489,16 @@ OPimContact OPimContactAccessBackend_SQL::find( int uid, const QArray<int>& quer
{
odebug << "OPimContactAccessBackend_SQL::find( ..multi.. )" << oendl;
odebug << "searching for " << uid << "" << oendl;
QTime t;
t.start();
-
+
uint numReadAhead = readAhead();
QArray<int> searchList( numReadAhead );
-
+
uint size =0;
// Build an array with all elements which should be requested and cached
// We will just request "numReadAhead" elements, starting from "current" position in
// the list of many uids !
switch( direction ) {
@@ -621,12 +621,14 @@ QArray<int> OPimContactAccessBackend_SQL::queryByExample ( const OPimContact &qu
else
searchQuery += "(\"" + *it + "\"" + " GLOB " + "'"
+ queryStr + "'" + ")";
}
}
+
+ delete endDate;
}
// Skip trailing "AND"
// if ( isAnyFieldSelected )
// qu = qu.left( qu.length() - 4 );
qu += searchQuery;
@@ -822,28 +824,28 @@ QMap<int, QString> OPimContactAccessBackend_SQL::requestNonCustom( int uid ) co
QMap<int, QString> nonCustomMap;
QTime t3;
t3.start();
nonCustomMap = fillNonCustomMap( resItem );
t3needed = t3.elapsed();
-
+
// odebug << "Adding UID: " << resItem.data( "uid" ) << "" << oendl;
odebug << "RequestNonCustom needed: insg.:" << t.elapsed() << " ms, query: " << t2needed
<< " ms, mapping: " << t3needed << " ms" << oendl;
return nonCustomMap;
}
-/* Returns contact requested by uid and fills cache with contacts requested by uids in the cachelist */
+/* Returns contact requested by uid and fills cache with contacts requested by uids in the cachelist */
OPimContact OPimContactAccessBackend_SQL::requestContactsAndCache( int uid, const QArray<int>& uidlist )const
{
// We want to get all contacts with one query.
// We don't have to add the given uid to the uidlist, it is expected to be there already (see opimrecordlist.h).
// All contacts will be stored in the cache, afterwards the contact with the user id "uid" will be returned
- // by using the cache..
+ // by using the cache..
QArray<int> cachelist = uidlist;
OPimContact retContact;
odebug << "Reqest and cache" << cachelist.size() << "elements !" << oendl;
QTime t;
@@ -868,18 +870,18 @@ OPimContact OPimContactAccessBackend_SQL::requestContactsAndCache( int uid, cons
cache( contact );
if ( contact.uid() == uid )
retContact = contact;
resItem = res_noncustom.next();
} while ( ! res_noncustom.atEnd() ); //atEnd() is true if we are past(!) the list !!
t3needed = t3.elapsed();
-
+
// odebug << "Adding UID: " << resItem.data( "uid" ) << "" << oendl;
odebug << "RequestContactsAndCache needed: insg.:" << t.elapsed() << " ms, query: " << t2needed
<< " ms, mapping: " << t3needed << " ms" << oendl;
-
+
return retContact;
}
QMap<int, QString> OPimContactAccessBackend_SQL::fillNonCustomMap( const OSQLResultItem& resultItem ) const
{
QMap<int, QString> nonCustomMap;