org.araneaframework.backend.list
Class SqlLikeUtil

java.lang.Object
  extended byorg.araneaframework.backend.list.SqlLikeUtil

public class SqlLikeUtil
extends Object

Helper class for database LIKE expression.

Author:
Rein Raudjärv, Martti Tamm (martti at araneaframework dot org)
See Also:
RegexpLikeUtil

Field Summary
static String SQL_LIKE_ANY_CHAR_WILDCARD
           
static String SQL_LIKE_ANY_STRING_WILDCARD
           
 
Constructor Summary
SqlLikeUtil()
           
 
Method Summary
static String convertEndMask(String mask, LikeConfiguration config, String escapeChar)
          Changes the mask so that it would include all values ending with current mask value.
static String convertMask(String mask, LikeConfiguration config, String escapeChar)
          Converts SQL LIKE mask in custom format (specified by LikeConfiguration) into SQL Like standard format.
static String convertStartMask(String mask, LikeConfiguration config, String escapeChar)
          Changes the mask so that it would include all values beginning with current mask value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SQL_LIKE_ANY_STRING_WILDCARD

public static final String SQL_LIKE_ANY_STRING_WILDCARD
See Also:
Constant Field Values

SQL_LIKE_ANY_CHAR_WILDCARD

public static final String SQL_LIKE_ANY_CHAR_WILDCARD
See Also:
Constant Field Values
Constructor Detail

SqlLikeUtil

public SqlLikeUtil()
Method Detail

convertMask

public static final String convertMask(String mask,
                                       LikeConfiguration config,
                                       String escapeChar)
Converts SQL LIKE mask in custom format (specified by LikeConfiguration) into SQL Like standard format.

The output may contain escape characters. Therefore the result must be used in format (expression) LIKE (mask) ESCAPE (escapeChar).

Parameters:
mask - mask in custom format.
config - configuration that holds mask custom format and behaivor.
escapeChar - escape character for SQL syntax.
Returns:
the mask in standard format.

convertStartMask

public static final String convertStartMask(String mask,
                                            LikeConfiguration config,
                                            String escapeChar)
Changes the mask so that it would include all values beginning with current mask value.

Parameters:
mask - A mask to change to include wildcard in the end.
config - Configuration of the expression.
escapeChar - Escape char to use for escaping.
Returns:
Mask that filters all values with certain prefix.
Since:
1.1.3

convertEndMask

public static final String convertEndMask(String mask,
                                          LikeConfiguration config,
                                          String escapeChar)
Changes the mask so that it would include all values ending with current mask value.

Parameters:
mask - A mask to change to include wildcard in the beginning.
config - Configuration of the expression.
escapeChar - Escape char to use for escaping.
Returns:
Mask that filters all values with certain suffix.
Since:
1.1.3