com.ibm.commerce.member.search

Class WhereClauseSearchCondition

  • All Implemented Interfaces:
    java.io.Serializable


    public class WhereClauseSearchCondition
    extends WhereClauseCondition
    These objects represent WHERE clause conditions for searching based on parameter values. Usage:
                    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.

    See Also:
    Serialized Form
    • Field Detail

      • COPYRIGHT

        public static final java.lang.String COPYRIGHT
        IBM Copyright
        See Also:
        Constant Field Values
      • CLASSNAME

        public static final java.lang.String CLASSNAME
        The class name.
      • SEARCHTYPE_CASESENSITIVE_STARTSWITH

        public static final int SEARCHTYPE_CASESENSITIVE_STARTSWITH
        SEARCHTYPE_CASESENSITIVE_STARTSWITH
        See Also:
        Constant Field Values
      • SEARCHTYPE_CASESENSITIVE_CONTAINS

        public static final int SEARCHTYPE_CASESENSITIVE_CONTAINS
        SEARCHTYPE_CASESENSITIVE_CONTAINS
        See Also:
        Constant Field Values
      • SEARCHTYPE_CASEINSENSITIVE_STARTSWITH

        public static final int SEARCHTYPE_CASEINSENSITIVE_STARTSWITH
        SEARCHTYPE_CASEINSENSITIVE_STARTSWITH
        See Also:
        Constant Field Values
      • SEARCHTYPE_CASEINSENSITIVE_CONTAINS

        public static final int SEARCHTYPE_CASEINSENSITIVE_CONTAINS
        SEARCHTYPE_CASEINSENSITIVE_CONTAINS
        See Also:
        Constant Field Values
      • SEARCHTYPE_CASESENSITIVE_EXACTMATCH

        public static final int SEARCHTYPE_CASESENSITIVE_EXACTMATCH
        SEARCHTYPE_CASESENSITIVE_EXACTMATCH
        See Also:
        Constant Field Values
      • SEARCHTYPE_CASEINSENSITIVE_EXACTMATCH

        public static final int SEARCHTYPE_CASEINSENSITIVE_EXACTMATCH
        SEARCHTYPE_CASEINSENSITIVE_EXACTMATCH
        See Also:
        Constant Field Values
      • SEARCHTYPE_NUMERIC

        public static final int SEARCHTYPE_NUMERIC
        SEARCHTYPE_NUMERIC
        See Also:
        Constant Field Values
      • SEARCHTYPE_NOT_EQUALS

        public static final int SEARCHTYPE_NOT_EQUALS
        SEARCHTYPE_NOT_EQUALS
        See Also:
        Constant Field Values
      • SEARCHTYPE_SOUNDEX

        public static final int SEARCHTYPE_SOUNDEX
        SEARCHTYPE_SOUNDEX
        See Also:
        Constant Field Values
      • SEARCHTYPE_ISNULL

        public static final int SEARCHTYPE_ISNULL
        SEARCHTYPE_ISNULL
        See Also:
        Constant Field Values
      • SEARCHTYPE_ISNOTNULL

        public static final int SEARCHTYPE_ISNOTNULL
        SEARCHTYPE_ISNOTNULL
        See Also:
        Constant Field Values
    • Constructor Detail

      • WhereClauseSearchCondition

        public WhereClauseSearchCondition(TableField atfSearchTableField,
                                          int anSearchType,
                                          java.lang.String astrSearchValue)
        Constructor. Sets the FROM tables and WHERE clause. If the parameters passed in are invalid, then both will be set to NULL.
         Usage:
         
           ECWhereClause whereClause = new ECSearchWhereClause(
                        new ECTableField("USERS", "FIELD1"),
              ECSearchWhereClause.SEARCHTYPE_CASEINSENSITIVE_EXACTMATCH,
              "myfield1value");
        
        Parameters:
        atfSearchTableField - The table and field to check.
        anSearchType - The search type.
        astrSearchValue - The value to search for.
    • Method Detail

      • getSearchString

        public static java.lang.String getSearchString(int anSearchType,
                                                       TableField atfSearchTableField)
        Gets a search string based on a search type and a table field.
         For example, 
         
                Given search type: SEARCHTYPE_CASESENSITIVE_STARTSWITH
                          and table field: ORGENTITY.ORGENTITYNAME
         
                Will return: 
                        ORGENTITY.ORGENTITYNAME LIKE ? escape '\\'
         
        Parameters:
        anSearchType - The search type.
        atfSearchTableField - The search table and field.
        Returns:
        The search string.
      • getSearchParameter

        public static java.lang.String getSearchParameter(int anSearchType,
                                                          java.lang.String astrSearchValue)
        Get the search parameter. Will format the string passed in, and prepare it for the type of query specified.
        Parameters:
        anSearchType - The search type.
        astrSearchValue - The search value.
        Returns:
        The search parameter to be used when executing the query.