Package com.databricks.jdbc.common.util
Class WildcardUtil
- java.lang.Object
-
- com.databricks.jdbc.common.util.WildcardUtil
-
public class WildcardUtil extends Object
This class consists of utility functions with respect to wildcard strings that are required in building SQL queries
-
-
Constructor Summary
Constructors Constructor Description WildcardUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringescapeCatalogName(String catalogName)Escapes unescaped_wildcard characters in a catalog name by prepending\.static booleanisMatchAnything(String s)This function checks if the input string is a "match anything" string i.estatic booleanisNullOrEmpty(String s)static booleanisNullOrWildcard(String s)static booleanisWildcard(String s)This function checks if the input string is a wildcard stringstatic StringjdbcPatternToHive(String pattern)static StringstripJdbcEscapes(String value)Strips JDBC escape sequences from a string, producing the literal value.
-
-
-
Method Detail
-
isMatchAnything
public static boolean isMatchAnything(String s)
This function checks if the input string is a "match anything" string i.e. "*"- Parameters:
s- the input string- Returns:
- true if the input string is "*"
-
isNullOrEmpty
public static boolean isNullOrEmpty(String s)
-
isNullOrWildcard
public static boolean isNullOrWildcard(String s)
-
isWildcard
public static boolean isWildcard(String s)
This function checks if the input string is a wildcard string- Parameters:
s- the input string- Returns:
- true if the input string is wildcard
-
escapeCatalogName
public static String escapeCatalogName(String catalogName)
Escapes unescaped_wildcard characters in a catalog name by prepending\. Already-escaped sequences (\_) are left unchanged.- Parameters:
catalogName- the catalog name to escape- Returns:
- the escaped catalog name, or
nullif the input isnull
-
stripJdbcEscapes
public static String stripJdbcEscapes(String value)
Strips JDBC escape sequences from a string, producing the literal value. Use this for SQL identifiers (e.g. catalog names inside backticks) where JDBC wildcard semantics don't apply.\_becomes_,\\becomes\, and unescaped characters (including%and_) are kept as-is since they are literals in identifier context.- Parameters:
value- the string potentially containing JDBC escape sequences- Returns:
- the unescaped string, or
nullif the input isnull
-
-