public class WhereClauseSearchCondition extends WhereClauseCondition
WhereClauseSearchCondition whereClause = new WhereClauseSearchCondition( new TableField("USERREG", "LOGONID"), WhereClauseSearchCondition.SEARCHTYPE_CASEINSENSITIVE_CONTAINS, "myLogonId");This example would generate a WHERE clause condition like:
USERREG.LOGONID LIKE ?with parameter myLogonId
There is a variety of search types supported, for example, searching case sensitive searching, case insensitive, starts-with, ends-with, contains, and for numeric equals.
Warning: Case insensitive queries can be expensive for the DBMS to execute. Please consult your DBMS documentation for instructions on how to set up indexes to allow for efficient case insensitive searching of the fields that you wish to expose to your client applications.
Warning: Queries using the 'contains' search type can be very expensive for the DBMS to execute. When possible, these should be avoided. Using an 'exact match', or 'starts with', search type is much more efficient.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CLASSNAME
The class name.
|
static java.lang.String |
COPYRIGHT
IBM Copyright
|
static int |
SEARCHTYPE_CASEINSENSITIVE_CONTAINS
SEARCHTYPE_CASEINSENSITIVE_CONTAINS
|
static int |
SEARCHTYPE_CASEINSENSITIVE_EXACTMATCH
SEARCHTYPE_CASEINSENSITIVE_EXACTMATCH
|
static int |
SEARCHTYPE_CASEINSENSITIVE_STARTSWITH
SEARCHTYPE_CASEINSENSITIVE_STARTSWITH
|
static int |
SEARCHTYPE_CASESENSITIVE_CONTAINS
SEARCHTYPE_CASESENSITIVE_CONTAINS
|
static int |
SEARCHTYPE_CASESENSITIVE_EXACTMATCH
SEARCHTYPE_CASESENSITIVE_EXACTMATCH
|
static int |
SEARCHTYPE_CASESENSITIVE_STARTSWITH
SEARCHTYPE_CASESENSITIVE_STARTSWITH
|
static int |
SEARCHTYPE_ISNOTNULL
SEARCHTYPE_ISNOTNULL
|
static int |
SEARCHTYPE_ISNULL
SEARCHTYPE_ISNULL
|
static int |
SEARCHTYPE_NOT_EQUALS
SEARCHTYPE_NOT_EQUALS
|
static int |
SEARCHTYPE_NUMERIC
SEARCHTYPE_NUMERIC
|
static int |
SEARCHTYPE_SOUNDEX
SEARCHTYPE_SOUNDEX
|
SQL_AND, SQL_CLOSE_BRACKET, SQL_EQUALS, SQL_ESCAPE, SQL_LIKE, SQL_NOT_EQUALS, SQL_OPEN_BRACKET, SQL_OR, SQL_QUOTE, SQL_SOUNDEX, SQL_TRUE_CONDITION, SQL_WILDCARD
Constructor and Description |
---|
WhereClauseSearchCondition(TableField atfSearchTableField,
int anSearchType,
java.lang.String astrSearchValue)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
getSearchParameter(int anSearchType,
java.lang.String astrSearchValue)
Get the search parameter.
|
static java.lang.String |
getSearchString(int anSearchType,
TableField atfSearchTableField)
Gets a search string based on a search type and a table field.
|
appendANDCondition, appendORCondition, getFromTables, getWhereClauseParameterValues, getWhereClauseSQL, isValid, toString
public static final java.lang.String COPYRIGHT
public static final java.lang.String CLASSNAME
public static final int SEARCHTYPE_CASESENSITIVE_STARTSWITH
public static final int SEARCHTYPE_CASESENSITIVE_CONTAINS
public static final int SEARCHTYPE_CASEINSENSITIVE_STARTSWITH
public static final int SEARCHTYPE_CASEINSENSITIVE_CONTAINS
public static final int SEARCHTYPE_CASESENSITIVE_EXACTMATCH
public static final int SEARCHTYPE_CASEINSENSITIVE_EXACTMATCH
public static final int SEARCHTYPE_NUMERIC
public static final int SEARCHTYPE_NOT_EQUALS
public static final int SEARCHTYPE_SOUNDEX
public static final int SEARCHTYPE_ISNULL
public static final int SEARCHTYPE_ISNOTNULL
public WhereClauseSearchCondition(TableField atfSearchTableField, int anSearchType, java.lang.String astrSearchValue)
Usage: ECWhereClause whereClause = new ECSearchWhereClause( new ECTableField("USERS", "FIELD1"), ECSearchWhereClause.SEARCHTYPE_CASEINSENSITIVE_EXACTMATCH, "myfield1value");
atfSearchTableField
- The table and field to check.anSearchType
- The search type.astrSearchValue
- The value to search for.public static java.lang.String getSearchString(int anSearchType, TableField atfSearchTableField)
For example, Given search type: SEARCHTYPE_CASESENSITIVE_STARTSWITH and table field: ORGENTITY.ORGENTITYNAME Will return: ORGENTITY.ORGENTITYNAME LIKE ? escape '\\'
anSearchType
- The search type.atfSearchTableField
- The search table and field.public static java.lang.String getSearchParameter(int anSearchType, java.lang.String astrSearchValue)
anSearchType
- The search type.astrSearchValue
- The search value.