summaryrefslogtreecommitdiff
path: root/libopie2/opiepim
authorbrad <brad>2004-04-11 12:43:55 (UTC)
committer brad <brad>2004-04-11 12:43:55 (UTC)
commit9716f8c5672a8596306a9b432d9fabc4361baea5 (patch) (unidiff)
tree2b4f23f7e1291ff9f3ff7788068918e31ed63bef /libopie2/opiepim
parent40c0415fe7afeeb03de7441e2f667495e81edfa7 (diff)
downloadopie-9716f8c5672a8596306a9b432d9fabc4361baea5.zip
opie-9716f8c5672a8596306a9b432d9fabc4361baea5.tar.gz
opie-9716f8c5672a8596306a9b432d9fabc4361baea5.tar.bz2
Fixes for sqlite regex driver. Function must be implemented as
rlike("pattern","match") instead of "where uid rlike("99")" you must use "where rlike("99",uid). My mistake. Also fixes for pointer math for context regex caching.
Diffstat (limited to 'libopie2/opiepim') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/backend/ocontactaccessbackend_sql.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/libopie2/opiepim/backend/ocontactaccessbackend_sql.cpp b/libopie2/opiepim/backend/ocontactaccessbackend_sql.cpp
index bb5c99b..401a3c1 100644
--- a/libopie2/opiepim/backend/ocontactaccessbackend_sql.cpp
+++ b/libopie2/opiepim/backend/ocontactaccessbackend_sql.cpp
@@ -598,26 +598,26 @@ QArray<int> OPimContactAccessBackend_SQL::queryByExample ( const OPimContact &qu
598 598
599 return list; 599 return list;
600} 600}
601 601
602QArray<int> OPimContactAccessBackend_SQL::matchRegexp( const QRegExp &r ) const 602QArray<int> OPimContactAccessBackend_SQL::matchRegexp( const QRegExp &r ) const
603{ 603{
604#if 1 604#if 0
605 QArray<int> nix(0); 605 QArray<int> nix(0);
606 return nix; 606 return nix;
607 607
608#else 608#else
609 QString qu = "SELECT uid FROM addressbook WHERE ("; 609 QString qu = "SELECT uid FROM addressbook WHERE (";
610 QString searchlist; 610 QString searchlist;
611 611
612 QStringList fieldList = OPimContactFields::untrfields( false ); 612 QStringList fieldList = OPimContactFields::untrfields( false );
613 // QMap<QString, int> translate = OPimContactFields::untrFieldsToId(); 613 // QMap<QString, int> translate = OPimContactFields::untrFieldsToId();
614 for ( QStringList::Iterator it = ++fieldList.begin(); it != fieldList.end(); ++it ){ 614 for ( QStringList::Iterator it = ++fieldList.begin(); it != fieldList.end(); ++it ){
615 if ( !searchlist.isEmpty() ) 615 if ( !searchlist.isEmpty() )
616 searchlist += " OR "; 616 searchlist += " OR ";
617 searchlist += "\"" + *it + "\" rlike(\"" + r.pattern() + "\") "; 617 searchlist += " rlike(\""+ r.pattern() + "\",\"" + *it + "\") ";
618 } 618 }
619 619
620 qu = qu + searchlist + ")"; 620 qu = qu + searchlist + ")";
621 621
622 qDebug( "query: %s", qu.latin1() ); 622 qDebug( "query: %s", qu.latin1() );
623 623