| java.lang.Object org.apache.derby.iapi.types.Like
Like | public class Like (Code) | | Like matching algorithm. Not too speedy for %s.
SQL92 says the escape character can only and must be followed
by itself, %, or _. So if you choose % or _ as the escape character,
you can no longer do that sort of matching.
Not the most recent Like -- missing the unit tests
author: ames |
Method Summary | |
static Boolean | checkLengths(int vLoc, int vEnd, int pLoc, char[] pat, int pEnd) checkLengths -- non-national chars
Returns null if we are not done. | static Boolean | checkLengths(int vLoc, int vEnd, int pLoc, int[] pat, int pEnd, int[] anyStringInts) checkLengths -- national chars
Returns null if we are not done. | static int | getMinLen(char[] pattern, int pStart, int pEnd, boolean haveEsc, char escChar) | static int | getMinLen(int[] pattern, int pStart, int pEnd, boolean haveEsc, int[] escCharInts, int[] anyStringInts) | public static String | greaterEqualString(String pattern, String escape, int maxWidth) Return the substring from the pattern for the optimization >= clause. | public static String | greaterEqualStringFromParameter(String pattern, int maxWidth) | public static String | greaterEqualStringFromParameterWithEsc(String pattern, String escape, int maxWidth) | public static boolean | isLikeComparisonNeeded(String pattern) Return whether or not the like comparison is still needed after
performing the like transformation on a constant string. | public static boolean | isOptimizable(String pattern) Determine whether or not this LIKE can be transformed into optimizable
clauses. | public static String | lessThanString(String pattern, String escape, int maxWidth) Return the substring from the pattern for the < clause. | public static String | lessThanStringFromParameter(String pattern, int maxWidth) | public static String | lessThanStringFromParameterWithEsc(String pattern, String escape, int maxWidth) | public static Boolean | like(char[] val, int valLength, char[] pat, int patLength, char[] escape, int escapeLength) Parameters: val - value to compare. | public static Boolean | like(int[] val, int valLength, int[] pat, int patLength, int[] escape, int escapeLength, RuleBasedCollator collator) For national chars.
Parameters: val - value to compare. | public static Boolean | like(char[] value, int valueLength, char[] pattern, int patternLength) | public static Boolean | like(int[] value, int valueLength, int[] pattern, int patternLength, RuleBasedCollator collator) | public static String | stripEscapesNoPatternChars(String pattern, char escChar) |
checkLengths | static Boolean checkLengths(int vLoc, int vEnd, int pLoc, char[] pat, int pEnd)(Code) | | checkLengths -- non-national chars
Returns null if we are not done.
Returns true if we are at the end of our value and pattern
Returns false if there is more pattern left but out of input value
Parameters: vLoc - current index into char[] val Parameters: vEnd - end index or our value Parameters: pLoc - current index into our char[] pattern Parameters: pat - pattern char [] Parameters: pEnd - end index of our pattern [] |
checkLengths | static Boolean checkLengths(int vLoc, int vEnd, int pLoc, int[] pat, int pEnd, int[] anyStringInts)(Code) | | checkLengths -- national chars
Returns null if we are not done.
Returns true if we are at the end of our value and pattern
Returns false if there is more pattern left but out of input value
Parameters: vLoc - current index into int[] val Parameters: vEnd - end index or our value Parameters: pLoc - current index into our int[] pattern Parameters: pat - pattern int [] Parameters: pEnd - end index of our pattern [] |
getMinLen | static int getMinLen(char[] pattern, int pStart, int pEnd, boolean haveEsc, char escChar)(Code) | | Calculate the shortest length string that could match this pattern for non-national chars
|
getMinLen | static int getMinLen(int[] pattern, int pStart, int pEnd, boolean haveEsc, int[] escCharInts, int[] anyStringInts)(Code) | | Calculate the shortest length string that could match this pattern for national chars
|
greaterEqualString | public static String greaterEqualString(String pattern, String escape, int maxWidth) throws StandardException(Code) | | Return the substring from the pattern for the optimization >= clause.
Parameters: pattern - The right side of the LIKE Parameters: escape - The escape clause Parameters: maxWidth - Maximum length of column, for null padding The String for the >= clause |
isLikeComparisonNeeded | public static boolean isLikeComparisonNeeded(String pattern)(Code) | | Return whether or not the like comparison is still needed after
performing the like transformation on a constant string. The
comparison is not needed if the constant string is of the form:
CONSTANT% (constant followed by a trailing %)
Parameters: pattern - The right side of the LIKE Whether or not the like comparison is still needed. |
isOptimizable | public static boolean isOptimizable(String pattern)(Code) | | Determine whether or not this LIKE can be transformed into optimizable
clauses. It can if the pattern is non-null and if the length == 0 or
the first character is not a wild card.
Parameters: pattern - The right side of the LIKE Whether or not the LIKE can be transformed |
lessThanString | public static String lessThanString(String pattern, String escape, int maxWidth) throws StandardException(Code) | | Return the substring from the pattern for the < clause.
Parameters: pattern - The right side of the LIKE Parameters: escape - The escape clause Parameters: maxWidth - Maximum length of column, for null padding The String for the < clause exception: StandardException - thrown if data invalid |
like | public static Boolean like(char[] val, int valLength, char[] pat, int patLength, char[] escape, int escapeLength) throws StandardException(Code) | | Parameters: val - value to compare. if null, result is null. Parameters: valLength - length of val Parameters: pat - pattern to compare. if null, result is null. Parameters: patLength - length of pat Parameters: escape - escape character. Must be 1 char long.if null, no escape character is used. Parameters: escapeLength - length of escape null if val or pat null, otherwise true if matchand false if not. exception: StandardException - thrown if data invalid |
like | public static Boolean like(int[] val, int valLength, int[] pat, int patLength, int[] escape, int escapeLength, RuleBasedCollator collator) throws StandardException(Code) | | For national chars.
Parameters: val - value to compare. if null, result is null. Parameters: valLength - length of val Parameters: pat - pattern to compare. if null, result is null. Parameters: patLength - length of pat Parameters: escape - escape character. Must be 1 char long.if null, no escape character is used. Parameters: escapeLength - length of escape Parameters: collator - The collator to use. null if val or pat null, otherwise true if matchand false if not. exception: StandardException - thrown if data invalid |
stripEscapesNoPatternChars | public static String stripEscapesNoPatternChars(String pattern, char escChar) throws StandardException(Code) | | stripEscapesNoPatternChars
Parameters: pattern - pattern String to search Parameters: escChar - the escape character a stripped of ESC char string if no pattern chars, null otherwise exception: StandardException - thrown if data invalid |
|
|