dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #29207
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14729: Added methods for regex match of words to StatementBuilder
------------------------------------------------------------
revno: 14729
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2014-04-07 16:27:23 +0200
message:
Added methods for regex match of words to StatementBuilder
modified:
dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcEventAnalyticsTableManager.java
dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/StatementBuilder.java
dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/H2StatementBuilder.java
dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/HsqlStatementBuilder.java
dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/MySQLStatementBuilder.java
dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/PostgreSQLStatementBuilder.java
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcEventAnalyticsTableManager.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcEventAnalyticsTableManager.java 2014-04-07 10:35:04 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcEventAnalyticsTableManager.java 2014-04-07 14:27:23 +0000
@@ -45,7 +45,6 @@
import org.hisp.dhis.period.PeriodType;
import org.hisp.dhis.program.Program;
import org.hisp.dhis.program.ProgramService;
-import org.hisp.dhis.program.ProgramTrackedEntityAttribute;
import org.hisp.dhis.system.util.DateUtils;
import org.hisp.dhis.system.util.MathUtils;
import org.hisp.dhis.trackedentity.TrackedEntityAttribute;
=== modified file 'dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/StatementBuilder.java'
--- dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/StatementBuilder.java 2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/StatementBuilder.java 2014-04-07 14:27:23 +0000
@@ -116,10 +116,20 @@
String getDoubleColumnType();
/**
- * Returns the value used to match a column to a regular expression.
- * @return the value used to match a column to a regular expression.
+ * Returns the value used to match a column to a regular expression. Matching
+ * is case insensitive.
*/
String getRegexpMatch();
+
+ /**
+ * Returns the regular expression marker for end of a word.
+ */
+ String getRegexpWordStart();
+
+ /**
+ * Returns the regular expression marker for start of a word.
+ */
+ String getRegexpWordEnd();
/**
* Creates a SELECT statement returning the identifier of the given Period.
=== modified file 'dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/H2StatementBuilder.java'
--- dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/H2StatementBuilder.java 2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/H2StatementBuilder.java 2014-04-07 14:27:23 +0000
@@ -65,6 +65,18 @@
{
return "regexp";
}
+
+ @Override
+ public String getRegexpWordStart() //TODO test
+ {
+ return "[[:<:]]";
+ }
+
+ @Override
+ public String getRegexpWordEnd()
+ {
+ return " [[:>:]]";
+ }
@Override
public String getDeleteZeroDataValues()
=== modified file 'dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/HsqlStatementBuilder.java'
--- dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/HsqlStatementBuilder.java 2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/HsqlStatementBuilder.java 2014-04-07 14:27:23 +0000
@@ -65,6 +65,18 @@
{
return "regexp";
}
+
+ @Override
+ public String getRegexpWordStart() //TODO test
+ {
+ return "[[:<:]]";
+ }
+
+ @Override
+ public String getRegexpWordEnd()
+ {
+ return " [[:>:]]";
+ }
@Override
public String getDeleteZeroDataValues()
=== modified file 'dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/MySQLStatementBuilder.java'
--- dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/MySQLStatementBuilder.java 2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/MySQLStatementBuilder.java 2014-04-07 14:27:23 +0000
@@ -65,6 +65,18 @@
{
return "regexp";
}
+
+ @Override
+ public String getRegexpWordStart()
+ {
+ return "[[:<:]]";
+ }
+
+ @Override
+ public String getRegexpWordEnd()
+ {
+ return " [[:>:]]";
+ }
@Override
public String getDeleteZeroDataValues()
=== modified file 'dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/PostgreSQLStatementBuilder.java'
--- dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/PostgreSQLStatementBuilder.java 2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/PostgreSQLStatementBuilder.java 2014-04-07 14:27:23 +0000
@@ -81,7 +81,19 @@
@Override
public String getRegexpMatch()
{
- return "~";
+ return "~*";
+ }
+
+ @Override
+ public String getRegexpWordStart()
+ {
+ return "\\m";
+ }
+
+ @Override
+ public String getRegexpWordEnd()
+ {
+ return "\\M";
}
@Override