summaryrefslogtreecommitdiff
path: root/connectivity
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2012-11-25 00:55:16 +0100
committerStephan Bergmann <sbergman@redhat.com>2012-11-25 01:09:48 +0100
commitdb8826007035255a4b3e4a3ef0377d28415a3a93 (patch)
tree2b050cee0b097dcf91aa96435d210266c1719f46 /connectivity
parent5d0402cfccd7efaeb4f65c48c295af91e52df0da (diff)
Implement MQueryOp::RegExp functionality
Change-Id: I9daf60f42dcba4e4c6444ccd8ad94258424621fe
Diffstat (limited to 'connectivity')
-rw-r--r--connectivity/Library_mork.mk1
-rw-r--r--connectivity/source/drivers/mork/MQueryHelper.cxx12
2 files changed, 10 insertions, 3 deletions
diff --git a/connectivity/Library_mork.mk b/connectivity/Library_mork.mk
index b11cb4f586af..1e565e81e281 100644
--- a/connectivity/Library_mork.mk
+++ b/connectivity/Library_mork.mk
@@ -27,6 +27,7 @@ $(eval $(call gb_Library_use_libraries,mork, \
dbtools \
sal \
salhelper \
+ utl \
$(gb_UWINAPI) \
))
diff --git a/connectivity/source/drivers/mork/MQueryHelper.cxx b/connectivity/source/drivers/mork/MQueryHelper.cxx
index e02db93393d5..0f48a6a41265 100644
--- a/connectivity/source/drivers/mork/MQueryHelper.cxx
+++ b/connectivity/source/drivers/mork/MQueryHelper.cxx
@@ -34,6 +34,7 @@
#include "resource/common_res.hrc"
#include <connectivity/dbexception.hxx>
+#include <unotools/textsearch.hxx>
using namespace connectivity::mork;
using namespace connectivity;
@@ -329,9 +330,14 @@ sal_Int32 MQueryHelper::executeQuery(OConnection* xConnection)
SAL_INFO("connectivity.mork", "MQueryOp::DoesNotContain; done");
resultVector.push_back((currentValue.indexOf(searchedValue) == -1) ? sal_True : sal_False);
} else if (evStr->getCond() == MQueryOp::RegExp) {
- SAL_WARN("connectivity.mork", "MQueryOp::RegExp; TODO");
- OSL_FAIL("regexp criterion is not yet implemented");
- _aQuery->getError().setResId(STR_ERROR_GET_ROW);
+ SAL_INFO("connectivity.mork", "MQueryOp::RegExp; done");
+ utl::SearchParam param(
+ searchedValue, utl::SearchParam::SRCH_REGEXP);
+ utl::TextSearch ts(param, LANGUAGE_DONTKNOW);
+ sal_Int32 start = 0;
+ sal_Int32 end = currentValue.getLength();
+ resultVector.push_back(
+ ts.SearchForward(currentValue, &start, &end));
}
} else if (evStr->getCond() == MQueryOp::Exists) {
SAL_INFO("connectivity.mork", "MQueryOp::Exists; done");