public class Like
extends java.lang.Object
| Modifier and Type | Field | Description |
|---|---|---|
private static char |
anyChar |
|
private static char |
anyString |
|
private static java.lang.String |
SUPER_STRING |
| Modifier | Constructor | Description |
|---|---|---|
private |
Like() |
| Modifier and Type | Method | Description |
|---|---|---|
private static boolean |
checkEquality(char[] val,
int vLoc,
char[] pat,
int pLoc,
java.text.RuleBasedCollator collator) |
If the character in val matches the character in pat, then it does not
matter if the database is UCS_BASIC or territory based, we simply return
TRUE from the method.
|
(package private) static java.lang.Boolean |
checkLengths(int vLoc,
int vEnd,
int pLoc,
char[] pat,
int pEnd) |
checkLengths
Returns null if we are not done.
|
(package private) static int |
getMinLen(char[] pattern,
int pStart,
int pEnd,
boolean haveEsc,
char escChar) |
Calculate the shortest length string that could match this pattern
|
private static java.lang.String |
greaterEqualString(java.lang.String pattern,
char escChar) |
greaterEqualString -- for Escape clause only
Walk the pattern character by character
|
static java.lang.String |
greaterEqualString(java.lang.String pattern,
java.lang.String escape,
int maxWidth) |
Return the substring from the pattern for the optimization >= clause.
|
static java.lang.String |
greaterEqualStringFromParameter(java.lang.String pattern,
int maxWidth) |
|
static java.lang.String |
greaterEqualStringFromParameterWithEsc(java.lang.String pattern,
java.lang.String escape,
int maxWidth) |
|
static boolean |
isLikeComparisonNeeded(java.lang.String pattern) |
Return whether or not the like comparison is still needed after
performing the like transformation on a constant string.
|
static boolean |
isOptimizable(java.lang.String pattern) |
Determine whether or not this LIKE can be transformed into optimizable
clauses.
|
static java.lang.String |
lessThanString(java.lang.String pattern,
java.lang.String escape,
int maxWidth) |
Return the substring from the pattern for the < clause.
|
static java.lang.String |
lessThanStringFromParameter(java.lang.String pattern,
int maxWidth) |
|
static java.lang.String |
lessThanStringFromParameterWithEsc(java.lang.String pattern,
java.lang.String escape,
int maxWidth) |
|
static java.lang.Boolean |
like(char[] val,
int valLength,
char[] pat,
int patLength,
char[] escape,
int escapeLength,
java.text.RuleBasedCollator collator) |
This method gets called for UCS_BASIC and territory based character
string types to look for a pattern in a value string.
|
static java.lang.Boolean |
like(char[] value,
int valueLength,
char[] pattern,
int patternLength,
java.text.RuleBasedCollator collator) |
|
private static java.lang.Boolean |
like(char[] val,
int vLoc,
int vEnd,
char[] pat,
int pLoc,
int pEnd,
char[] escape,
int escapeLength,
java.text.RuleBasedCollator collator) |
|
private static java.lang.String |
padWithNulls(java.lang.String string,
int len) |
Pad a string with null characters, in order to make it > and <
comparable with SQLChar.
|
static java.lang.String |
stripEscapesNoPatternChars(java.lang.String pattern,
char escChar) |
stripEscapesNoPatternChars
|
private static final char anyChar
private static final char anyString
private static final java.lang.String SUPER_STRING
public static java.lang.Boolean like(char[] val,
int valLength,
char[] pat,
int patLength,
char[] escape,
int escapeLength,
java.text.RuleBasedCollator collator)
throws StandardException
val - value to compare. if null, result is null.valLength - length of valpat - pattern to compare. if null, result is null.patLength - length of patescape - escape character. Must be 1 char long.
if null, no escape character is used.escapeLength - length of escapecollator - null if we are dealing with UCS_BASIC
character string types. If not null, then we use it to
get collation elements for characters in val and
non-metacharacters in pat to do the comparison.StandardException - thrown if data invalidprivate static java.lang.Boolean like(char[] val,
int vLoc,
int vEnd,
char[] pat,
int pLoc,
int pEnd,
char[] escape,
int escapeLength,
java.text.RuleBasedCollator collator)
throws StandardException
StandardExceptionprivate static boolean checkEquality(char[] val,
int vLoc,
char[] pat,
int pLoc,
java.text.RuleBasedCollator collator)
val - value to compare.vLoc - character position in val.pat - pattern to look for in val.pLoc - character position in pat.collator - null if we are dealing with UCS_BASIC character string
types. If not null, then we use it to determine the equality of the
2 characters in pat and val if they are not same.static int getMinLen(char[] pattern,
int pStart,
int pEnd,
boolean haveEsc,
char escChar)
static java.lang.Boolean checkLengths(int vLoc,
int vEnd,
int pLoc,
char[] pat,
int pEnd)
vLoc - current index into char[] valvEnd - end index or our valuepLoc - current index into our char[] patternpat - pattern char []pEnd - end index of our pattern []public static java.lang.Boolean like(char[] value,
int valueLength,
char[] pattern,
int patternLength,
java.text.RuleBasedCollator collator)
throws StandardException
StandardExceptionpublic static boolean isOptimizable(java.lang.String pattern)
pattern - The right side of the LIKEpublic static java.lang.String greaterEqualStringFromParameter(java.lang.String pattern,
int maxWidth)
throws StandardException
StandardExceptionpublic static java.lang.String greaterEqualStringFromParameterWithEsc(java.lang.String pattern,
java.lang.String escape,
int maxWidth)
throws StandardException
StandardExceptionpublic static java.lang.String greaterEqualString(java.lang.String pattern,
java.lang.String escape,
int maxWidth)
throws StandardException
pattern - The right side of the LIKEescape - The escape clausemaxWidth - Maximum length of column, for null paddingStandardExceptionprivate static java.lang.String greaterEqualString(java.lang.String pattern,
char escChar)
throws StandardException
pattern - like pattern to build fromescChar - the escape character in the patternStandardExceptionpublic static java.lang.String stripEscapesNoPatternChars(java.lang.String pattern,
char escChar)
throws StandardException
pattern - pattern String to searchescChar - the escape characterStandardException - thrown if data invalidpublic static java.lang.String lessThanStringFromParameter(java.lang.String pattern,
int maxWidth)
throws StandardException
StandardExceptionpublic static java.lang.String lessThanStringFromParameterWithEsc(java.lang.String pattern,
java.lang.String escape,
int maxWidth)
throws StandardException
StandardExceptionpublic static java.lang.String lessThanString(java.lang.String pattern,
java.lang.String escape,
int maxWidth)
throws StandardException
pattern - The right side of the LIKEescape - The escape clausemaxWidth - Maximum length of column, for null paddingStandardException - thrown if data invalidpublic static boolean isLikeComparisonNeeded(java.lang.String pattern)
pattern - The right side of the LIKEprivate static java.lang.String padWithNulls(java.lang.String string,
int len)
string - The string to padlen - Max number of characters to pad toApache Derby V10.14 Internals - Copyright © 2004,2018 The Apache Software Foundation. All Rights Reserved.