author | mickeyl <mickeyl> | 2004-02-24 12:46:23 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-02-24 12:46:23 (UTC) |
commit | 911473db35a9fce5f3589f03c27210456faaba86 (patch) (unidiff) | |
tree | 7d55b6117b24de6ab18747b00a4641d38001c0ed /libopie2/opiepim/backend/ocontactaccessbackend_sql.cpp | |
parent | a2ead23c3614fe581261455cb4c3f31cee2098f3 (diff) | |
download | opie-911473db35a9fce5f3589f03c27210456faaba86.zip opie-911473db35a9fce5f3589f03c27210456faaba86.tar.gz opie-911473db35a9fce5f3589f03c27210456faaba86.tar.bz2 |
*phew* here is the class and file rename patch. not converted yet: backend,
but that will be not visible to application classes so we can change it later.
Diffstat (limited to 'libopie2/opiepim/backend/ocontactaccessbackend_sql.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opiepim/backend/ocontactaccessbackend_sql.cpp | 136 |
1 files changed, 68 insertions, 68 deletions
diff --git a/libopie2/opiepim/backend/ocontactaccessbackend_sql.cpp b/libopie2/opiepim/backend/ocontactaccessbackend_sql.cpp index d0c8052..f121cc2 100644 --- a/libopie2/opiepim/backend/ocontactaccessbackend_sql.cpp +++ b/libopie2/opiepim/backend/ocontactaccessbackend_sql.cpp | |||
@@ -30,26 +30,26 @@ | |||
30 | * SQL Backend for the OPIE-Contact Database. | 30 | * SQL Backend for the OPIE-Contact Database. |
31 | */ | 31 | */ |
32 | 32 | ||
33 | #include "ocontactaccessbackend_sql.h" | 33 | #include "ocontactaccessbackend_sql.h" |
34 | 34 | ||
35 | #include <qarray.h> | 35 | #include <qarray.h> |
36 | #include <qdatetime.h> | 36 | #include <qdatetime.h> |
37 | #include <qstringlist.h> | 37 | #include <qstringlist.h> |
38 | 38 | ||
39 | #include <qpe/global.h> | 39 | #include <qpe/global.h> |
40 | #include <qpe/recordfields.h> | 40 | #include <qpe/recordfields.h> |
41 | 41 | ||
42 | #include <opie2/ocontactfields.h> | 42 | #include <opie2/opimcontactfields.h> |
43 | #include <opie2/oconversion.h> | 43 | #include <opie2/opimdateconversion.h> |
44 | #include <opie2/osqldriver.h> | 44 | #include <opie2/osqldriver.h> |
45 | #include <opie2/osqlresult.h> | 45 | #include <opie2/osqlresult.h> |
46 | #include <opie2/osqlmanager.h> | 46 | #include <opie2/osqlmanager.h> |
47 | #include <opie2/osqlquery.h> | 47 | #include <opie2/osqlquery.h> |
48 | 48 | ||
49 | 49 | ||
50 | 50 | ||
51 | 51 | ||
52 | // If defined, we use a horizontal table ( uid, attr1, attr2, attr3, ..., attrn ) instead | 52 | // If defined, we use a horizontal table ( uid, attr1, attr2, attr3, ..., attrn ) instead |
53 | // vertical like "uid, type, value". | 53 | // vertical like "uid, type, value". |
54 | // DON'T DEACTIVATE THIS DEFINE IN PRODUCTIVE ENVIRONMENTS !! | 54 | // DON'T DEACTIVATE THIS DEFINE IN PRODUCTIVE ENVIRONMENTS !! |
55 | #define __STORE_HORIZONTAL_ | 55 | #define __STORE_HORIZONTAL_ |
@@ -96,33 +96,33 @@ namespace Opie { | |||
96 | /** | 96 | /** |
97 | * LoadQuery | 97 | * LoadQuery |
98 | * this one queries for all uids | 98 | * this one queries for all uids |
99 | */ | 99 | */ |
100 | class LoadQuery : public OSQLQuery { | 100 | class LoadQuery : public OSQLQuery { |
101 | public: | 101 | public: |
102 | LoadQuery(); | 102 | LoadQuery(); |
103 | ~LoadQuery(); | 103 | ~LoadQuery(); |
104 | QString query()const; | 104 | QString query()const; |
105 | }; | 105 | }; |
106 | 106 | ||
107 | /** | 107 | /** |
108 | * inserts/adds a OContact to the table | 108 | * inserts/adds a OPimContact to the table |
109 | */ | 109 | */ |
110 | class InsertQuery : public OSQLQuery { | 110 | class InsertQuery : public OSQLQuery { |
111 | public: | 111 | public: |
112 | InsertQuery(const OContact& ); | 112 | InsertQuery(const OPimContact& ); |
113 | ~InsertQuery(); | 113 | ~InsertQuery(); |
114 | QString query()const; | 114 | QString query()const; |
115 | private: | 115 | private: |
116 | OContact m_contact; | 116 | OPimContact m_contact; |
117 | }; | 117 | }; |
118 | 118 | ||
119 | 119 | ||
120 | /** | 120 | /** |
121 | * removes one from the table | 121 | * removes one from the table |
122 | */ | 122 | */ |
123 | class RemoveQuery : public OSQLQuery { | 123 | class RemoveQuery : public OSQLQuery { |
124 | public: | 124 | public: |
125 | RemoveQuery(int uid ); | 125 | RemoveQuery(int uid ); |
126 | ~RemoveQuery(); | 126 | ~RemoveQuery(); |
127 | QString query()const; | 127 | QString query()const; |
128 | private: | 128 | private: |
@@ -167,25 +167,25 @@ namespace Opie { | |||
167 | // 1. addressbook : It contains General information about the contact (non custom) | 167 | // 1. addressbook : It contains General information about the contact (non custom) |
168 | // 2. custom_data : Not official supported entries | 168 | // 2. custom_data : Not official supported entries |
169 | // All tables are connected by the uid of the contact. | 169 | // All tables are connected by the uid of the contact. |
170 | // Maybe I should add a table for meta-information ? | 170 | // Maybe I should add a table for meta-information ? |
171 | CreateQuery::CreateQuery() : OSQLQuery() {} | 171 | CreateQuery::CreateQuery() : OSQLQuery() {} |
172 | CreateQuery::~CreateQuery() {} | 172 | CreateQuery::~CreateQuery() {} |
173 | QString CreateQuery::query()const { | 173 | QString CreateQuery::query()const { |
174 | QString qu; | 174 | QString qu; |
175 | #ifdef __STORE_HORIZONTAL_ | 175 | #ifdef __STORE_HORIZONTAL_ |
176 | 176 | ||
177 | qu += "create table addressbook( uid PRIMARY KEY "; | 177 | qu += "create table addressbook( uid PRIMARY KEY "; |
178 | 178 | ||
179 | QStringList fieldList = OContactFields::untrfields( false ); | 179 | QStringList fieldList = OPimContactFields::untrfields( false ); |
180 | for ( QStringList::Iterator it = ++fieldList.begin(); it != fieldList.end(); ++it ){ | 180 | for ( QStringList::Iterator it = ++fieldList.begin(); it != fieldList.end(); ++it ){ |
181 | qu += QString( ",\"%1\" VARCHAR(10)" ).arg( *it ); | 181 | qu += QString( ",\"%1\" VARCHAR(10)" ).arg( *it ); |
182 | } | 182 | } |
183 | qu += " );"; | 183 | qu += " );"; |
184 | 184 | ||
185 | qu += "create table custom_data( uid INTEGER, id INTEGER, type VARCHAR, priority INTEGER, value VARCHAR, PRIMARY KEY /* identifier */ (uid, id) );"; | 185 | qu += "create table custom_data( uid INTEGER, id INTEGER, type VARCHAR, priority INTEGER, value VARCHAR, PRIMARY KEY /* identifier */ (uid, id) );"; |
186 | 186 | ||
187 | #else | 187 | #else |
188 | 188 | ||
189 | qu += "create table addressbook( uid INTEGER, id INTEGER, type VARCHAR, priority INTEGER, value VARCHAR, PRIMARY KEY /* identifier */ (uid, id));"; | 189 | qu += "create table addressbook( uid INTEGER, id INTEGER, type VARCHAR, priority INTEGER, value VARCHAR, PRIMARY KEY /* identifier */ (uid, id));"; |
190 | qu += "create table custom_data( uid INTEGER, id INTEGER, type VARCHAR, priority INTEGER, value VARCHAR, PRIMARY KEY /* identifier */ (uid, id) );"; | 190 | qu += "create table custom_data( uid INTEGER, id INTEGER, type VARCHAR, priority INTEGER, value VARCHAR, PRIMARY KEY /* identifier */ (uid, id) );"; |
191 | // qu += "create table dates( uid PRIMARY KEY, type, day, month, year, hour, minute, second );"; | 191 | // qu += "create table dates( uid PRIMARY KEY, type, day, month, year, hour, minute, second );"; |
@@ -214,47 +214,47 @@ namespace Opie { | |||
214 | #else | 214 | #else |
215 | # ifndef __USE_SUPERFAST_LOADQUERY | 215 | # ifndef __USE_SUPERFAST_LOADQUERY |
216 | qu += "select distinct uid from addressbook"; | 216 | qu += "select distinct uid from addressbook"; |
217 | # else | 217 | # else |
218 | qu += "select uid from addressbook where type = 'Last Name'"; | 218 | qu += "select uid from addressbook where type = 'Last Name'"; |
219 | # endif // __USE_SUPERFAST_LOADQUERY | 219 | # endif // __USE_SUPERFAST_LOADQUERY |
220 | #endif // __STORE_HORIZONTAL_ | 220 | #endif // __STORE_HORIZONTAL_ |
221 | 221 | ||
222 | return qu; | 222 | return qu; |
223 | } | 223 | } |
224 | 224 | ||
225 | 225 | ||
226 | InsertQuery::InsertQuery( const OContact& contact ) | 226 | InsertQuery::InsertQuery( const OPimContact& contact ) |
227 | : OSQLQuery(), m_contact( contact ) { | 227 | : OSQLQuery(), m_contact( contact ) { |
228 | } | 228 | } |
229 | 229 | ||
230 | InsertQuery::~InsertQuery() { | 230 | InsertQuery::~InsertQuery() { |
231 | } | 231 | } |
232 | 232 | ||
233 | /* | 233 | /* |
234 | * converts from a OContact to a query | 234 | * converts from a OPimContact to a query |
235 | */ | 235 | */ |
236 | QString InsertQuery::query()const{ | 236 | QString InsertQuery::query()const{ |
237 | 237 | ||
238 | #ifdef __STORE_HORIZONTAL_ | 238 | #ifdef __STORE_HORIZONTAL_ |
239 | QString qu; | 239 | QString qu; |
240 | qu += "insert into addressbook VALUES( " + | 240 | qu += "insert into addressbook VALUES( " + |
241 | QString::number( m_contact.uid() ); | 241 | QString::number( m_contact.uid() ); |
242 | 242 | ||
243 | // Get all information out of the contact-class | 243 | // Get all information out of the contact-class |
244 | // Remember: The category is stored in contactMap, too ! | 244 | // Remember: The category is stored in contactMap, too ! |
245 | QMap<int, QString> contactMap = m_contact.toMap(); | 245 | QMap<int, QString> contactMap = m_contact.toMap(); |
246 | 246 | ||
247 | QStringList fieldList = OContactFields::untrfields( false ); | 247 | QStringList fieldList = OPimContactFields::untrfields( false ); |
248 | QMap<QString, int> translate = OContactFields::untrFieldsToId(); | 248 | QMap<QString, int> translate = OPimContactFields::untrFieldsToId(); |
249 | for ( QStringList::Iterator it = ++fieldList.begin(); it != fieldList.end(); ++it ){ | 249 | for ( QStringList::Iterator it = ++fieldList.begin(); it != fieldList.end(); ++it ){ |
250 | // Convert Column-String to Id and get value for this id.. | 250 | // Convert Column-String to Id and get value for this id.. |
251 | // Hmmm.. Maybe not very cute solution.. | 251 | // Hmmm.. Maybe not very cute solution.. |
252 | int id = translate[*it]; | 252 | int id = translate[*it]; |
253 | switch ( id ){ | 253 | switch ( id ){ |
254 | case Qtopia::Birthday:{ | 254 | case Qtopia::Birthday:{ |
255 | // These entries should stored in a special format | 255 | // These entries should stored in a special format |
256 | // year-month-day | 256 | // year-month-day |
257 | QDate day = m_contact.birthday(); | 257 | QDate day = m_contact.birthday(); |
258 | if ( day.isValid() ){ | 258 | if ( day.isValid() ){ |
259 | qu += QString(",\"%1-%2-%3\"") | 259 | qu += QString(",\"%1-%2-%3\"") |
260 | .arg( day.year() ) | 260 | .arg( day.year() ) |
@@ -286,25 +286,25 @@ namespace Opie { | |||
286 | } | 286 | } |
287 | qu += " );"; | 287 | qu += " );"; |
288 | 288 | ||
289 | 289 | ||
290 | #else | 290 | #else |
291 | // Get all information out of the contact-class | 291 | // Get all information out of the contact-class |
292 | // Remember: The category is stored in contactMap, too ! | 292 | // Remember: The category is stored in contactMap, too ! |
293 | QMap<int, QString> contactMap = m_contact.toMap(); | 293 | QMap<int, QString> contactMap = m_contact.toMap(); |
294 | 294 | ||
295 | QMap<QString, QString> addressbook_db; | 295 | QMap<QString, QString> addressbook_db; |
296 | 296 | ||
297 | // Get the translation from the ID to the String | 297 | // Get the translation from the ID to the String |
298 | QMap<int, QString> transMap = OContactFields::idToUntrFields(); | 298 | QMap<int, QString> transMap = OPimContactFields::idToUntrFields(); |
299 | 299 | ||
300 | for( QMap<int, QString>::Iterator it = contactMap.begin(); | 300 | for( QMap<int, QString>::Iterator it = contactMap.begin(); |
301 | it != contactMap.end(); ++it ){ | 301 | it != contactMap.end(); ++it ){ |
302 | switch ( it.key() ){ | 302 | switch ( it.key() ){ |
303 | case Qtopia::Birthday:{ | 303 | case Qtopia::Birthday:{ |
304 | // These entries should stored in a special format | 304 | // These entries should stored in a special format |
305 | // year-month-day | 305 | // year-month-day |
306 | QDate day = m_contact.birthday(); | 306 | QDate day = m_contact.birthday(); |
307 | addressbook_db.insert( transMap[it.key()], | 307 | addressbook_db.insert( transMap[it.key()], |
308 | QString("%1-%2-%3") | 308 | QString("%1-%2-%3") |
309 | .arg( day.year() ) | 309 | .arg( day.year() ) |
310 | .arg( day.month() ) | 310 | .arg( day.month() ) |
@@ -450,180 +450,180 @@ namespace Opie { | |||
450 | QString qu = "select uid, type, value from custom_data where uid = "; | 450 | QString qu = "select uid, type, value from custom_data where uid = "; |
451 | qu += QString::number(m_uid); | 451 | qu += QString::number(m_uid); |
452 | return qu; | 452 | return qu; |
453 | } | 453 | } |
454 | 454 | ||
455 | }; | 455 | }; |
456 | 456 | ||
457 | 457 | ||
458 | /* --------------------------------------------------------------------------- */ | 458 | /* --------------------------------------------------------------------------- */ |
459 | 459 | ||
460 | namespace Opie { | 460 | namespace Opie { |
461 | 461 | ||
462 | OContactAccessBackend_SQL::OContactAccessBackend_SQL ( const QString& /* appname */, | 462 | OPimContactAccessBackend_SQL::OPimContactAccessBackend_SQL ( const QString& /* appname */, |
463 | const QString& filename ): | 463 | const QString& filename ): |
464 | OContactAccessBackend(), m_changed(false), m_driver( NULL ) | 464 | OPimContactAccessBackend(), m_changed(false), m_driver( NULL ) |
465 | { | 465 | { |
466 | qWarning("C'tor OContactAccessBackend_SQL starts"); | 466 | qWarning("C'tor OPimContactAccessBackend_SQL starts"); |
467 | QTime t; | 467 | QTime t; |
468 | t.start(); | 468 | t.start(); |
469 | 469 | ||
470 | /* Expecting to access the default filename if nothing else is set */ | 470 | /* Expecting to access the default filename if nothing else is set */ |
471 | if ( filename.isEmpty() ){ | 471 | if ( filename.isEmpty() ){ |
472 | m_fileName = Global::applicationFileName( "addressbook","addressbook.db" ); | 472 | m_fileName = Global::applicationFileName( "addressbook","addressbook.db" ); |
473 | } else | 473 | } else |
474 | m_fileName = filename; | 474 | m_fileName = filename; |
475 | 475 | ||
476 | // Get the standart sql-driver from the OSQLManager.. | 476 | // Get the standart sql-driver from the OSQLManager.. |
477 | OSQLManager man; | 477 | OSQLManager man; |
478 | m_driver = man.standard(); | 478 | m_driver = man.standard(); |
479 | m_driver->setUrl( m_fileName ); | 479 | m_driver->setUrl( m_fileName ); |
480 | 480 | ||
481 | load(); | 481 | load(); |
482 | 482 | ||
483 | qWarning("C'tor OContactAccessBackend_SQL ends: %d ms", t.elapsed() ); | 483 | qWarning("C'tor OPimContactAccessBackend_SQL ends: %d ms", t.elapsed() ); |
484 | } | 484 | } |
485 | 485 | ||
486 | OContactAccessBackend_SQL::~OContactAccessBackend_SQL () | 486 | OPimContactAccessBackend_SQL::~OPimContactAccessBackend_SQL () |
487 | { | 487 | { |
488 | if( m_driver ) | 488 | if( m_driver ) |
489 | delete m_driver; | 489 | delete m_driver; |
490 | } | 490 | } |
491 | 491 | ||
492 | bool OContactAccessBackend_SQL::load () | 492 | bool OPimContactAccessBackend_SQL::load () |
493 | { | 493 | { |
494 | if (!m_driver->open() ) | 494 | if (!m_driver->open() ) |
495 | return false; | 495 | return false; |
496 | 496 | ||
497 | // Don't expect that the database exists. | 497 | // Don't expect that the database exists. |
498 | // It is save here to create the table, even if it | 498 | // It is save here to create the table, even if it |
499 | // do exist. ( Is that correct for all databases ?? ) | 499 | // do exist. ( Is that correct for all databases ?? ) |
500 | CreateQuery creat; | 500 | CreateQuery creat; |
501 | OSQLResult res = m_driver->query( &creat ); | 501 | OSQLResult res = m_driver->query( &creat ); |
502 | 502 | ||
503 | update(); | 503 | update(); |
504 | 504 | ||
505 | return true; | 505 | return true; |
506 | 506 | ||
507 | } | 507 | } |
508 | 508 | ||
509 | bool OContactAccessBackend_SQL::reload() | 509 | bool OPimContactAccessBackend_SQL::reload() |
510 | { | 510 | { |
511 | return load(); | 511 | return load(); |
512 | } | 512 | } |
513 | 513 | ||
514 | bool OContactAccessBackend_SQL::save() | 514 | bool OPimContactAccessBackend_SQL::save() |
515 | { | 515 | { |
516 | return m_driver->close(); // Shouldn't m_driver->sync be better than close ? (eilers) | 516 | return m_driver->close(); // Shouldn't m_driver->sync be better than close ? (eilers) |
517 | } | 517 | } |
518 | 518 | ||
519 | 519 | ||
520 | void OContactAccessBackend_SQL::clear () | 520 | void OPimContactAccessBackend_SQL::clear () |
521 | { | 521 | { |
522 | ClearQuery cle; | 522 | ClearQuery cle; |
523 | OSQLResult res = m_driver->query( &cle ); | 523 | OSQLResult res = m_driver->query( &cle ); |
524 | 524 | ||
525 | reload(); | 525 | reload(); |
526 | } | 526 | } |
527 | 527 | ||
528 | bool OContactAccessBackend_SQL::wasChangedExternally() | 528 | bool OPimContactAccessBackend_SQL::wasChangedExternally() |
529 | { | 529 | { |
530 | return false; | 530 | return false; |
531 | } | 531 | } |
532 | 532 | ||
533 | QArray<int> OContactAccessBackend_SQL::allRecords() const | 533 | QArray<int> OPimContactAccessBackend_SQL::allRecords() const |
534 | { | 534 | { |
535 | 535 | ||
536 | // FIXME: Think about cute handling of changed tables.. | 536 | // FIXME: Think about cute handling of changed tables.. |
537 | // Thus, we don't have to call update here... | 537 | // Thus, we don't have to call update here... |
538 | if ( m_changed ) | 538 | if ( m_changed ) |
539 | ((OContactAccessBackend_SQL*)this)->update(); | 539 | ((OPimContactAccessBackend_SQL*)this)->update(); |
540 | 540 | ||
541 | return m_uids; | 541 | return m_uids; |
542 | } | 542 | } |
543 | 543 | ||
544 | bool OContactAccessBackend_SQL::add ( const OContact &newcontact ) | 544 | bool OPimContactAccessBackend_SQL::add ( const OPimContact &newcontact ) |
545 | { | 545 | { |
546 | InsertQuery ins( newcontact ); | 546 | InsertQuery ins( newcontact ); |
547 | OSQLResult res = m_driver->query( &ins ); | 547 | OSQLResult res = m_driver->query( &ins ); |
548 | 548 | ||
549 | if ( res.state() == OSQLResult::Failure ) | 549 | if ( res.state() == OSQLResult::Failure ) |
550 | return false; | 550 | return false; |
551 | 551 | ||
552 | int c = m_uids.count(); | 552 | int c = m_uids.count(); |
553 | m_uids.resize( c+1 ); | 553 | m_uids.resize( c+1 ); |
554 | m_uids[c] = newcontact.uid(); | 554 | m_uids[c] = newcontact.uid(); |
555 | 555 | ||
556 | return true; | 556 | return true; |
557 | } | 557 | } |
558 | 558 | ||
559 | 559 | ||
560 | bool OContactAccessBackend_SQL::remove ( int uid ) | 560 | bool OPimContactAccessBackend_SQL::remove ( int uid ) |
561 | { | 561 | { |
562 | RemoveQuery rem( uid ); | 562 | RemoveQuery rem( uid ); |
563 | OSQLResult res = m_driver->query(&rem ); | 563 | OSQLResult res = m_driver->query(&rem ); |
564 | 564 | ||
565 | if ( res.state() == OSQLResult::Failure ) | 565 | if ( res.state() == OSQLResult::Failure ) |
566 | return false; | 566 | return false; |
567 | 567 | ||
568 | m_changed = true; | 568 | m_changed = true; |
569 | 569 | ||
570 | return true; | 570 | return true; |
571 | } | 571 | } |
572 | 572 | ||
573 | bool OContactAccessBackend_SQL::replace ( const OContact &contact ) | 573 | bool OPimContactAccessBackend_SQL::replace ( const OPimContact &contact ) |
574 | { | 574 | { |
575 | if ( !remove( contact.uid() ) ) | 575 | if ( !remove( contact.uid() ) ) |
576 | return false; | 576 | return false; |
577 | 577 | ||
578 | return add( contact ); | 578 | return add( contact ); |
579 | } | 579 | } |
580 | 580 | ||
581 | 581 | ||
582 | OContact OContactAccessBackend_SQL::find ( int uid ) const | 582 | OPimContact OPimContactAccessBackend_SQL::find ( int uid ) const |
583 | { | 583 | { |
584 | qWarning("OContactAccessBackend_SQL::find()"); | 584 | qWarning("OPimContactAccessBackend_SQL::find()"); |
585 | QTime t; | 585 | QTime t; |
586 | t.start(); | 586 | t.start(); |
587 | 587 | ||
588 | OContact retContact( requestNonCustom( uid ) ); | 588 | OPimContact retContact( requestNonCustom( uid ) ); |
589 | retContact.setExtraMap( requestCustom( uid ) ); | 589 | retContact.setExtraMap( requestCustom( uid ) ); |
590 | 590 | ||
591 | qWarning("OContactAccessBackend_SQL::find() needed: %d ms", t.elapsed() ); | 591 | qWarning("OPimContactAccessBackend_SQL::find() needed: %d ms", t.elapsed() ); |
592 | return retContact; | 592 | return retContact; |
593 | } | 593 | } |
594 | 594 | ||
595 | 595 | ||
596 | 596 | ||
597 | QArray<int> OContactAccessBackend_SQL::queryByExample ( const OContact &query, int settings, const QDateTime& d = QDateTime() ) | 597 | QArray<int> OPimContactAccessBackend_SQL::queryByExample ( const OPimContact &query, int settings, const QDateTime& d = QDateTime() ) |
598 | { | 598 | { |
599 | QString qu = "SELECT uid FROM addressbook WHERE"; | 599 | QString qu = "SELECT uid FROM addressbook WHERE"; |
600 | 600 | ||
601 | QMap<int, QString> queryFields = query.toMap(); | 601 | QMap<int, QString> queryFields = query.toMap(); |
602 | QStringList fieldList = OContactFields::untrfields( false ); | 602 | QStringList fieldList = OPimContactFields::untrfields( false ); |
603 | QMap<QString, int> translate = OContactFields::untrFieldsToId(); | 603 | QMap<QString, int> translate = OPimContactFields::untrFieldsToId(); |
604 | 604 | ||
605 | // Convert every filled field to a SQL-Query | 605 | // Convert every filled field to a SQL-Query |
606 | bool isAnyFieldSelected = false; | 606 | bool isAnyFieldSelected = false; |
607 | for ( QStringList::Iterator it = ++fieldList.begin(); it != fieldList.end(); ++it ){ | 607 | for ( QStringList::Iterator it = ++fieldList.begin(); it != fieldList.end(); ++it ){ |
608 | int id = translate[*it]; | 608 | int id = translate[*it]; |
609 | QString queryStr = queryFields[id]; | 609 | QString queryStr = queryFields[id]; |
610 | if ( !queryStr.isEmpty() ){ | 610 | if ( !queryStr.isEmpty() ){ |
611 | isAnyFieldSelected = true; | 611 | isAnyFieldSelected = true; |
612 | switch( id ){ | 612 | switch( id ){ |
613 | default: | 613 | default: |
614 | // Switching between case sensitive and insensitive... | 614 | // Switching between case sensitive and insensitive... |
615 | // LIKE is not case sensitive, GLOB is case sensitive | 615 | // LIKE is not case sensitive, GLOB is case sensitive |
616 | // Do exist a better solution to switch this ? | 616 | // Do exist a better solution to switch this ? |
617 | if ( settings & OContactAccess::IgnoreCase ) | 617 | if ( settings & OPimContactAccess::IgnoreCase ) |
618 | qu += "(\"" + *it + "\"" + " LIKE " + "'" | 618 | qu += "(\"" + *it + "\"" + " LIKE " + "'" |
619 | + queryStr.replace(QRegExp("\\*"),"%") + "'" + ") AND "; | 619 | + queryStr.replace(QRegExp("\\*"),"%") + "'" + ") AND "; |
620 | else | 620 | else |
621 | qu += "(\"" + *it + "\"" + " GLOB " + "'" | 621 | qu += "(\"" + *it + "\"" + " GLOB " + "'" |
622 | + queryStr + "'" + ") AND "; | 622 | + queryStr + "'" + ") AND "; |
623 | 623 | ||
624 | } | 624 | } |
625 | } | 625 | } |
626 | } | 626 | } |
627 | // Skip trailing "AND" | 627 | // Skip trailing "AND" |
628 | if ( isAnyFieldSelected ) | 628 | if ( isAnyFieldSelected ) |
629 | qu = qu.left( qu.length() - 4 ); | 629 | qu = qu.left( qu.length() - 4 ); |
@@ -634,85 +634,85 @@ QArray<int> OContactAccessBackend_SQL::queryByExample ( const OContact &query, i | |||
634 | OSQLRawQuery raw( qu ); | 634 | OSQLRawQuery raw( qu ); |
635 | OSQLResult res = m_driver->query( &raw ); | 635 | OSQLResult res = m_driver->query( &raw ); |
636 | if ( res.state() != OSQLResult::Success ){ | 636 | if ( res.state() != OSQLResult::Success ){ |
637 | QArray<int> empty; | 637 | QArray<int> empty; |
638 | return empty; | 638 | return empty; |
639 | } | 639 | } |
640 | 640 | ||
641 | QArray<int> list = extractUids( res ); | 641 | QArray<int> list = extractUids( res ); |
642 | 642 | ||
643 | return list; | 643 | return list; |
644 | } | 644 | } |
645 | 645 | ||
646 | QArray<int> OContactAccessBackend_SQL::matchRegexp( const QRegExp &r ) const | 646 | QArray<int> OPimContactAccessBackend_SQL::matchRegexp( const QRegExp &r ) const |
647 | { | 647 | { |
648 | QArray<int> nix(0); | 648 | QArray<int> nix(0); |
649 | return nix; | 649 | return nix; |
650 | } | 650 | } |
651 | 651 | ||
652 | const uint OContactAccessBackend_SQL::querySettings() | 652 | const uint OPimContactAccessBackend_SQL::querySettings() |
653 | { | 653 | { |
654 | return OContactAccess::IgnoreCase | 654 | return OPimContactAccess::IgnoreCase |
655 | || OContactAccess::WildCards; | 655 | || OPimContactAccess::WildCards; |
656 | } | 656 | } |
657 | 657 | ||
658 | bool OContactAccessBackend_SQL::hasQuerySettings (uint querySettings) const | 658 | bool OPimContactAccessBackend_SQL::hasQuerySettings (uint querySettings) const |
659 | { | 659 | { |
660 | /* OContactAccess::IgnoreCase, DateDiff, DateYear, DateMonth, DateDay | 660 | /* OPimContactAccess::IgnoreCase, DateDiff, DateYear, DateMonth, DateDay |
661 | * may be added with any of the other settings. IgnoreCase should never used alone. | 661 | * may be added with any of the other settings. IgnoreCase should never used alone. |
662 | * Wildcards, RegExp, ExactMatch should never used at the same time... | 662 | * Wildcards, RegExp, ExactMatch should never used at the same time... |
663 | */ | 663 | */ |
664 | 664 | ||
665 | // Step 1: Check whether the given settings are supported by this backend | 665 | // Step 1: Check whether the given settings are supported by this backend |
666 | if ( ( querySettings & ( | 666 | if ( ( querySettings & ( |
667 | OContactAccess::IgnoreCase | 667 | OPimContactAccess::IgnoreCase |
668 | | OContactAccess::WildCards | 668 | | OPimContactAccess::WildCards |
669 | // | OContactAccess::DateDiff | 669 | // | OPimContactAccess::DateDiff |
670 | // | OContactAccess::DateYear | 670 | // | OPimContactAccess::DateYear |
671 | // | OContactAccess::DateMonth | 671 | // | OPimContactAccess::DateMonth |
672 | // | OContactAccess::DateDay | 672 | // | OPimContactAccess::DateDay |
673 | // | OContactAccess::RegExp | 673 | // | OPimContactAccess::RegExp |
674 | // | OContactAccess::ExactMatch | 674 | // | OPimContactAccess::ExactMatch |
675 | ) ) != querySettings ) | 675 | ) ) != querySettings ) |
676 | return false; | 676 | return false; |
677 | 677 | ||
678 | // Step 2: Check whether the given combinations are ok.. | 678 | // Step 2: Check whether the given combinations are ok.. |
679 | 679 | ||
680 | // IngoreCase alone is invalid | 680 | // IngoreCase alone is invalid |
681 | if ( querySettings == OContactAccess::IgnoreCase ) | 681 | if ( querySettings == OPimContactAccess::IgnoreCase ) |
682 | return false; | 682 | return false; |
683 | 683 | ||
684 | // WildCards, RegExp and ExactMatch should never used at the same time | 684 | // WildCards, RegExp and ExactMatch should never used at the same time |
685 | switch ( querySettings & ~( OContactAccess::IgnoreCase | 685 | switch ( querySettings & ~( OPimContactAccess::IgnoreCase |
686 | | OContactAccess::DateDiff | 686 | | OPimContactAccess::DateDiff |
687 | | OContactAccess::DateYear | 687 | | OPimContactAccess::DateYear |
688 | | OContactAccess::DateMonth | 688 | | OPimContactAccess::DateMonth |
689 | | OContactAccess::DateDay | 689 | | OPimContactAccess::DateDay |
690 | ) | 690 | ) |
691 | ){ | 691 | ){ |
692 | case OContactAccess::RegExp: | 692 | case OPimContactAccess::RegExp: |
693 | return ( true ); | 693 | return ( true ); |
694 | case OContactAccess::WildCards: | 694 | case OPimContactAccess::WildCards: |
695 | return ( true ); | 695 | return ( true ); |
696 | case OContactAccess::ExactMatch: | 696 | case OPimContactAccess::ExactMatch: |
697 | return ( true ); | 697 | return ( true ); |
698 | case 0: // one of the upper removed bits were set.. | 698 | case 0: // one of the upper removed bits were set.. |
699 | return ( true ); | 699 | return ( true ); |
700 | default: | 700 | default: |
701 | return ( false ); | 701 | return ( false ); |
702 | } | 702 | } |
703 | 703 | ||
704 | } | 704 | } |
705 | 705 | ||
706 | QArray<int> OContactAccessBackend_SQL::sorted( bool asc, int , int , int ) | 706 | QArray<int> OPimContactAccessBackend_SQL::sorted( bool asc, int , int , int ) |
707 | { | 707 | { |
708 | QTime t; | 708 | QTime t; |
709 | t.start(); | 709 | t.start(); |
710 | 710 | ||
711 | #ifdef __STORE_HORIZONTAL_ | 711 | #ifdef __STORE_HORIZONTAL_ |
712 | QString query = "SELECT uid FROM addressbook "; | 712 | QString query = "SELECT uid FROM addressbook "; |
713 | query += "ORDER BY \"Last Name\" "; | 713 | query += "ORDER BY \"Last Name\" "; |
714 | #else | 714 | #else |
715 | QString query = "SELECT uid FROM addressbook WHERE type = 'Last Name' "; | 715 | QString query = "SELECT uid FROM addressbook WHERE type = 'Last Name' "; |
716 | query += "ORDER BY upper( value )"; | 716 | query += "ORDER BY upper( value )"; |
717 | #endif | 717 | #endif |
718 | 718 | ||
@@ -726,196 +726,196 @@ QArray<int> OContactAccessBackend_SQL::sorted( bool asc, int , int , int ) | |||
726 | if ( res.state() != OSQLResult::Success ){ | 726 | if ( res.state() != OSQLResult::Success ){ |
727 | QArray<int> empty; | 727 | QArray<int> empty; |
728 | return empty; | 728 | return empty; |
729 | } | 729 | } |
730 | 730 | ||
731 | QArray<int> list = extractUids( res ); | 731 | QArray<int> list = extractUids( res ); |
732 | 732 | ||
733 | qWarning("sorted needed %d ms!", t.elapsed() ); | 733 | qWarning("sorted needed %d ms!", t.elapsed() ); |
734 | return list; | 734 | return list; |
735 | } | 735 | } |
736 | 736 | ||
737 | 737 | ||
738 | void OContactAccessBackend_SQL::update() | 738 | void OPimContactAccessBackend_SQL::update() |
739 | { | 739 | { |
740 | qWarning("Update starts"); | 740 | qWarning("Update starts"); |
741 | QTime t; | 741 | QTime t; |
742 | t.start(); | 742 | t.start(); |
743 | 743 | ||
744 | // Now load the database set and extract the uid's | 744 | // Now load the database set and extract the uid's |
745 | // which will be held locally | 745 | // which will be held locally |
746 | 746 | ||
747 | LoadQuery lo; | 747 | LoadQuery lo; |
748 | OSQLResult res = m_driver->query(&lo); | 748 | OSQLResult res = m_driver->query(&lo); |
749 | if ( res.state() != OSQLResult::Success ) | 749 | if ( res.state() != OSQLResult::Success ) |
750 | return; | 750 | return; |
751 | 751 | ||
752 | m_uids = extractUids( res ); | 752 | m_uids = extractUids( res ); |
753 | 753 | ||
754 | m_changed = false; | 754 | m_changed = false; |
755 | 755 | ||
756 | qWarning("Update ends %d ms", t.elapsed() ); | 756 | qWarning("Update ends %d ms", t.elapsed() ); |
757 | } | 757 | } |
758 | 758 | ||
759 | QArray<int> OContactAccessBackend_SQL::extractUids( OSQLResult& res ) const | 759 | QArray<int> OPimContactAccessBackend_SQL::extractUids( OSQLResult& res ) const |
760 | { | 760 | { |
761 | qWarning("extractUids"); | 761 | qWarning("extractUids"); |
762 | QTime t; | 762 | QTime t; |
763 | t.start(); | 763 | t.start(); |
764 | OSQLResultItem::ValueList list = res.results(); | 764 | OSQLResultItem::ValueList list = res.results(); |
765 | OSQLResultItem::ValueList::Iterator it; | 765 | OSQLResultItem::ValueList::Iterator it; |
766 | QArray<int> ints(list.count() ); | 766 | QArray<int> ints(list.count() ); |
767 | qWarning(" count = %d", list.count() ); | 767 | qWarning(" count = %d", list.count() ); |
768 | 768 | ||
769 | int i = 0; | 769 | int i = 0; |
770 | for (it = list.begin(); it != list.end(); ++it ) { | 770 | for (it = list.begin(); it != list.end(); ++it ) { |
771 | ints[i] = (*it).data("uid").toInt(); | 771 | ints[i] = (*it).data("uid").toInt(); |
772 | i++; | 772 | i++; |
773 | } | 773 | } |
774 | qWarning("extractUids ready: count2 = %d needs %d ms", i, t.elapsed() ); | 774 | qWarning("extractUids ready: count2 = %d needs %d ms", i, t.elapsed() ); |
775 | 775 | ||
776 | return ints; | 776 | return ints; |
777 | 777 | ||
778 | } | 778 | } |
779 | 779 | ||
780 | #ifdef __STORE_HORIZONTAL_ | 780 | #ifdef __STORE_HORIZONTAL_ |
781 | QMap<int, QString> OContactAccessBackend_SQL::requestNonCustom( int uid ) const | 781 | QMap<int, QString> OPimContactAccessBackend_SQL::requestNonCustom( int uid ) const |
782 | { | 782 | { |
783 | QTime t; | 783 | QTime t; |
784 | t.start(); | 784 | t.start(); |
785 | 785 | ||
786 | QMap<int, QString> nonCustomMap; | 786 | QMap<int, QString> nonCustomMap; |
787 | 787 | ||
788 | int t2needed = 0; | 788 | int t2needed = 0; |
789 | int t3needed = 0; | 789 | int t3needed = 0; |
790 | QTime t2; | 790 | QTime t2; |
791 | t2.start(); | 791 | t2.start(); |
792 | FindQuery query( uid ); | 792 | FindQuery query( uid ); |
793 | OSQLResult res_noncustom = m_driver->query( &query ); | 793 | OSQLResult res_noncustom = m_driver->query( &query ); |
794 | t2needed = t2.elapsed(); | 794 | t2needed = t2.elapsed(); |
795 | 795 | ||
796 | OSQLResultItem resItem = res_noncustom.first(); | 796 | OSQLResultItem resItem = res_noncustom.first(); |
797 | 797 | ||
798 | QTime t3; | 798 | QTime t3; |
799 | t3.start(); | 799 | t3.start(); |
800 | // Now loop through all columns | 800 | // Now loop through all columns |
801 | QStringList fieldList = OContactFields::untrfields( false ); | 801 | QStringList fieldList = OPimContactFields::untrfields( false ); |
802 | QMap<QString, int> translate = OContactFields::untrFieldsToId(); | 802 | QMap<QString, int> translate = OPimContactFields::untrFieldsToId(); |
803 | for ( QStringList::Iterator it = ++fieldList.begin(); it != fieldList.end(); ++it ){ | 803 | for ( QStringList::Iterator it = ++fieldList.begin(); it != fieldList.end(); ++it ){ |
804 | // Get data for the selected column and store it with the | 804 | // Get data for the selected column and store it with the |
805 | // corresponding id into the map.. | 805 | // corresponding id into the map.. |
806 | 806 | ||
807 | int id = translate[*it]; | 807 | int id = translate[*it]; |
808 | QString value = resItem.data( (*it) ); | 808 | QString value = resItem.data( (*it) ); |
809 | 809 | ||
810 | // qWarning("Reading %s... found: %s", (*it).latin1(), value.latin1() ); | 810 | // qWarning("Reading %s... found: %s", (*it).latin1(), value.latin1() ); |
811 | 811 | ||
812 | switch( id ){ | 812 | switch( id ){ |
813 | case Qtopia::Birthday: | 813 | case Qtopia::Birthday: |
814 | case Qtopia::Anniversary:{ | 814 | case Qtopia::Anniversary:{ |
815 | // Birthday and Anniversary are encoded special ( yyyy-mm-dd ) | 815 | // Birthday and Anniversary are encoded special ( yyyy-mm-dd ) |
816 | QStringList list = QStringList::split( '-', value ); | 816 | QStringList list = QStringList::split( '-', value ); |
817 | QStringList::Iterator lit = list.begin(); | 817 | QStringList::Iterator lit = list.begin(); |
818 | int year = (*lit).toInt(); | 818 | int year = (*lit).toInt(); |
819 | int month = (*(++lit)).toInt(); | 819 | int month = (*(++lit)).toInt(); |
820 | int day = (*(++lit)).toInt(); | 820 | int day = (*(++lit)).toInt(); |
821 | if ( ( day != 0 ) && ( month != 0 ) && ( year != 0 ) ){ | 821 | if ( ( day != 0 ) && ( month != 0 ) && ( year != 0 ) ){ |
822 | QDate date( year, month, day ); | 822 | QDate date( year, month, day ); |
823 | nonCustomMap.insert( id, OConversion::dateToString( date ) ); | 823 | nonCustomMap.insert( id, OPimDateConversion::dateToString( date ) ); |
824 | } | 824 | } |
825 | } | 825 | } |
826 | break; | 826 | break; |
827 | case Qtopia::AddressCategory: | 827 | case Qtopia::AddressCategory: |
828 | qWarning("Category is: %s", value.latin1() ); | 828 | qWarning("Category is: %s", value.latin1() ); |
829 | default: | 829 | default: |
830 | nonCustomMap.insert( id, value ); | 830 | nonCustomMap.insert( id, value ); |
831 | } | 831 | } |
832 | } | 832 | } |
833 | 833 | ||
834 | // First insert uid | 834 | // First insert uid |
835 | nonCustomMap.insert( Qtopia::AddressUid, resItem.data( "uid" ) ); | 835 | nonCustomMap.insert( Qtopia::AddressUid, resItem.data( "uid" ) ); |
836 | t3needed = t3.elapsed(); | 836 | t3needed = t3.elapsed(); |
837 | 837 | ||
838 | // qWarning("Adding UID: %s", resItem.data( "uid" ).latin1() ); | 838 | // qWarning("Adding UID: %s", resItem.data( "uid" ).latin1() ); |
839 | qWarning("RequestNonCustom needed: insg.:%d ms, query: %d ms, mapping: %d ms", | 839 | qWarning("RequestNonCustom needed: insg.:%d ms, query: %d ms, mapping: %d ms", |
840 | t.elapsed(), t2needed, t3needed ); | 840 | t.elapsed(), t2needed, t3needed ); |
841 | 841 | ||
842 | return nonCustomMap; | 842 | return nonCustomMap; |
843 | } | 843 | } |
844 | #else | 844 | #else |
845 | 845 | ||
846 | QMap<int, QString> OContactAccessBackend_SQL::requestNonCustom( int uid ) const | 846 | QMap<int, QString> OPimContactAccessBackend_SQL::requestNonCustom( int uid ) const |
847 | { | 847 | { |
848 | QTime t; | 848 | QTime t; |
849 | t.start(); | 849 | t.start(); |
850 | 850 | ||
851 | QMap<int, QString> nonCustomMap; | 851 | QMap<int, QString> nonCustomMap; |
852 | 852 | ||
853 | int t2needed = 0; | 853 | int t2needed = 0; |
854 | QTime t2; | 854 | QTime t2; |
855 | t2.start(); | 855 | t2.start(); |
856 | FindQuery query( uid ); | 856 | FindQuery query( uid ); |
857 | OSQLResult res_noncustom = m_driver->query( &query ); | 857 | OSQLResult res_noncustom = m_driver->query( &query ); |
858 | t2needed = t2.elapsed(); | 858 | t2needed = t2.elapsed(); |
859 | 859 | ||
860 | if ( res_noncustom.state() == OSQLResult::Failure ) { | 860 | if ( res_noncustom.state() == OSQLResult::Failure ) { |
861 | qWarning("OSQLResult::Failure in find query !!"); | 861 | qWarning("OSQLResult::Failure in find query !!"); |
862 | QMap<int, QString> empty; | 862 | QMap<int, QString> empty; |
863 | return empty; | 863 | return empty; |
864 | } | 864 | } |
865 | 865 | ||
866 | int t3needed = 0; | 866 | int t3needed = 0; |
867 | QTime t3; | 867 | QTime t3; |
868 | t3.start(); | 868 | t3.start(); |
869 | QMap<QString, int> translateMap = OContactFields::untrFieldsToId(); | 869 | QMap<QString, int> translateMap = OPimContactFields::untrFieldsToId(); |
870 | 870 | ||
871 | OSQLResultItem::ValueList list = res_noncustom.results(); | 871 | OSQLResultItem::ValueList list = res_noncustom.results(); |
872 | OSQLResultItem::ValueList::Iterator it = list.begin(); | 872 | OSQLResultItem::ValueList::Iterator it = list.begin(); |
873 | for ( ; it != list.end(); ++it ) { | 873 | for ( ; it != list.end(); ++it ) { |
874 | if ( (*it).data("type") != "" ){ | 874 | if ( (*it).data("type") != "" ){ |
875 | int typeId = translateMap[(*it).data( "type" )]; | 875 | int typeId = translateMap[(*it).data( "type" )]; |
876 | switch( typeId ){ | 876 | switch( typeId ){ |
877 | case Qtopia::Birthday: | 877 | case Qtopia::Birthday: |
878 | case Qtopia::Anniversary:{ | 878 | case Qtopia::Anniversary:{ |
879 | // Birthday and Anniversary are encoded special ( yyyy-mm-dd ) | 879 | // Birthday and Anniversary are encoded special ( yyyy-mm-dd ) |
880 | QStringList list = QStringList::split( '-', (*it).data( "value" ) ); | 880 | QStringList list = QStringList::split( '-', (*it).data( "value" ) ); |
881 | QStringList::Iterator lit = list.begin(); | 881 | QStringList::Iterator lit = list.begin(); |
882 | int year = (*lit).toInt(); | 882 | int year = (*lit).toInt(); |
883 | qWarning("1. %s", (*lit).latin1()); | 883 | qWarning("1. %s", (*lit).latin1()); |
884 | int month = (*(++lit)).toInt(); | 884 | int month = (*(++lit)).toInt(); |
885 | qWarning("2. %s", (*lit).latin1()); | 885 | qWarning("2. %s", (*lit).latin1()); |
886 | int day = (*(++lit)).toInt(); | 886 | int day = (*(++lit)).toInt(); |
887 | qWarning("3. %s", (*lit).latin1()); | 887 | qWarning("3. %s", (*lit).latin1()); |
888 | qWarning( "RequestNonCustom->Converting:%s to Year: %d, Month: %d, Day: %d ", (*it).data( "value" ).latin1(), year, month, day ); | 888 | qWarning( "RequestNonCustom->Converting:%s to Year: %d, Month: %d, Day: %d ", (*it).data( "value" ).latin1(), year, month, day ); |
889 | QDate date( year, month, day ); | 889 | QDate date( year, month, day ); |
890 | nonCustomMap.insert( typeId, OConversion::dateToString( date ) ); | 890 | nonCustomMap.insert( typeId, OPimDateConversion::dateToString( date ) ); |
891 | } | 891 | } |
892 | break; | 892 | break; |
893 | default: | 893 | default: |
894 | nonCustomMap.insert( typeId, | 894 | nonCustomMap.insert( typeId, |
895 | (*it).data( "value" ) ); | 895 | (*it).data( "value" ) ); |
896 | } | 896 | } |
897 | } | 897 | } |
898 | } | 898 | } |
899 | // Add UID to Map.. | 899 | // Add UID to Map.. |
900 | nonCustomMap.insert( Qtopia::AddressUid, QString::number( uid ) ); | 900 | nonCustomMap.insert( Qtopia::AddressUid, QString::number( uid ) ); |
901 | t3needed = t3.elapsed(); | 901 | t3needed = t3.elapsed(); |
902 | 902 | ||
903 | qWarning("RequestNonCustom needed: insg.:%d ms, query: %d ms, mapping: %d ms", t.elapsed(), t2needed, t3needed ); | 903 | qWarning("RequestNonCustom needed: insg.:%d ms, query: %d ms, mapping: %d ms", t.elapsed(), t2needed, t3needed ); |
904 | return nonCustomMap; | 904 | return nonCustomMap; |
905 | } | 905 | } |
906 | 906 | ||
907 | #endif // __STORE_HORIZONTAL_ | 907 | #endif // __STORE_HORIZONTAL_ |
908 | 908 | ||
909 | QMap<QString, QString> OContactAccessBackend_SQL::requestCustom( int uid ) const | 909 | QMap<QString, QString> OPimContactAccessBackend_SQL::requestCustom( int uid ) const |
910 | { | 910 | { |
911 | QTime t; | 911 | QTime t; |
912 | t.start(); | 912 | t.start(); |
913 | 913 | ||
914 | QMap<QString, QString> customMap; | 914 | QMap<QString, QString> customMap; |
915 | 915 | ||
916 | FindCustomQuery query( uid ); | 916 | FindCustomQuery query( uid ); |
917 | OSQLResult res_custom = m_driver->query( &query ); | 917 | OSQLResult res_custom = m_driver->query( &query ); |
918 | 918 | ||
919 | if ( res_custom.state() == OSQLResult::Failure ) { | 919 | if ( res_custom.state() == OSQLResult::Failure ) { |
920 | qWarning("OSQLResult::Failure in find query !!"); | 920 | qWarning("OSQLResult::Failure in find query !!"); |
921 | QMap<QString, QString> empty; | 921 | QMap<QString, QString> empty; |