-rw-r--r-- | libopie2/opiepim/backend/ocontactaccessbackend_sql.cpp | 37 |
1 files changed, 31 insertions, 6 deletions
diff --git a/libopie2/opiepim/backend/ocontactaccessbackend_sql.cpp b/libopie2/opiepim/backend/ocontactaccessbackend_sql.cpp index 3142f75..bb5c99b 100644 --- a/libopie2/opiepim/backend/ocontactaccessbackend_sql.cpp +++ b/libopie2/opiepim/backend/ocontactaccessbackend_sql.cpp | |||
@@ -599,20 +599,45 @@ QArray<int> OPimContactAccessBackend_SQL::queryByExample ( const OPimContact &qu | |||
599 | return list; | 599 | return list; |
600 | } | 600 | } |
601 | 601 | ||
602 | QArray<int> OPimContactAccessBackend_SQL::matchRegexp( const QRegExp &r ) const | 602 | QArray<int> OPimContactAccessBackend_SQL::matchRegexp( const QRegExp &r ) const |
603 | { | 603 | { |
604 | #if 1 | ||
604 | QArray<int> nix(0); | 605 | QArray<int> nix(0); |
605 | return nix; | 606 | return nix; |
607 | |||
608 | #else | ||
609 | QString qu = "SELECT uid FROM addressbook WHERE ("; | ||
610 | QString searchlist; | ||
611 | |||
612 | QStringList fieldList = OPimContactFields::untrfields( false ); | ||
613 | // QMap<QString, int> translate = OPimContactFields::untrFieldsToId(); | ||
614 | for ( QStringList::Iterator it = ++fieldList.begin(); it != fieldList.end(); ++it ){ | ||
615 | if ( !searchlist.isEmpty() ) | ||
616 | searchlist += " OR "; | ||
617 | searchlist += "\"" + *it + "\" rlike(\"" + r.pattern() + "\") "; | ||
618 | } | ||
619 | |||
620 | qu = qu + searchlist + ")"; | ||
621 | |||
622 | qDebug( "query: %s", qu.latin1() ); | ||
623 | |||
624 | OSQLRawQuery raw( qu ); | ||
625 | OSQLResult res = m_driver->query( &raw ); | ||
626 | |||
627 | return extractUids( res ); | ||
628 | |||
629 | |||
630 | #endif | ||
606 | } | 631 | } |
607 | 632 | ||
608 | const uint OPimContactAccessBackend_SQL::querySettings() | 633 | const uint OPimContactAccessBackend_SQL::querySettings() |
609 | { | 634 | { |
610 | return OPimContactAccess::IgnoreCase | 635 | return OPimContactAccess::IgnoreCase |
611 | || OPimContactAccess::WildCards | 636 | | OPimContactAccess::WildCards |
612 | || OPimContactAccess::DateDiff | 637 | | OPimContactAccess::DateDiff |
613 | || OPimContactAccess::DateYear | 638 | | OPimContactAccess::DateYear |
614 | || OPimContactAccess::DateMonth | 639 | | OPimContactAccess::DateMonth |
615 | || OPimContactAccess::DateDay | 640 | | OPimContactAccess::DateDay |
616 | ; | 641 | ; |
617 | } | 642 | } |
618 | 643 | ||