Modifier and Type | Field and Description |
---|---|
protected static char |
c_apo
The Constant c_apo.
|
Constructor and Description |
---|
util() |
Modifier and Type | Method and Description |
---|---|
static StringBuilder |
assembleEscape(StringBuilder sb,
String s)
Assemble escape.
|
static String |
assembleTimestamp(int... parts)
Assemble timestamp.
|
static String |
escape(String s)
Escape.
|
static String |
escapeIfNecessary(String s)
Escape if necessary.
|
static StringBuilder |
escapeIfNecessary(String s,
StringBuilder sb)
Escape if necessary.
|
static String |
escapeReservedWord(String s) |
static String |
getColumnName(Object o)
Gets the column name.
|
static String |
guessAlias(String tablename)
Guess alias.
|
static String |
guessAlias(String tablename,
int charCount)
Guess alias.
|
static String |
guessAlias(String tablename,
int minChars,
int maxChars)
Guess alias.
|
static boolean |
needsEscaping(SQL.DATATYPE columnType)
Needs escaping.
|
static SqlCondition |
parseCondition(Object object)
Parses the condition.
|
static SqlExpression |
parseExpression(Object obj)
Parses the expression.
|
static SqlExpression[] |
parseExpressionArray(Object... objects)
Parses the expression array.
|
static String[] |
parseFullQualifiedTablename(String fullQualifiedTablename)
Parses the full qualified tablename.
|
static String |
qualify(Object... parts)
Qualify.
|
static Boolean |
recognizeBoolean(Object object)
Utility method than recognizes Boolean values.
object can have several values that are recognized as boolean values:
- null value: returns null- Boolean value: returns object - Number value: return false for value 0, true otherwise - String value (caseinsensitive): returns false for "N" or "NO" , true for "Y" or "YES", otherwise value is not recognized Any unrecognizable value will cause a ClassCastException .Notes: - this method is inefficient if the type of object is already known.- use this method only if you are sure that the provided value is meant to be a boolean value of some form - the main purpose of this method is to handle boolean and pseudo-boolean values returned from different DBMS generically, no matter if it's a true boolean or 0/1 or stupid 0/-1 or "YES/NO", etc. |
static boolean |
recognizeBooleanPrimitive(Object object)
Like
recognizeBoolean , but maps null value to false . |
protected static final char c_apo
public static final boolean needsEscaping(SQL.DATATYPE columnType)
columnType
- the column typepublic static StringBuilder assembleEscape(StringBuilder sb, String s)
sb
- the sbs
- the spublic static final String guessAlias(String tablename)
tablename
- the tablenamepublic static final String guessAlias(String tablename, int charCount)
tablename
- the tablenamecharCount
- the char countpublic static final String guessAlias(String tablename, int minChars, int maxChars)
tablename
- the tablenameminChars
- the min charsmaxChars
- the max charspublic static final Boolean recognizeBoolean(Object object) throws ClassCastException
object
can have several values that are recognized as boolean values:
- null value: returns nullClassCastException
.object
is already known.object
- the objectClassCastException
- the class cast exceptionpublic static final boolean recognizeBooleanPrimitive(Object object) throws ClassCastException
recognizeBoolean
, but maps null value to false
.object
- the objectClassCastException
- the class cast exceptionpublic static final StringBuilder escapeIfNecessary(String s, StringBuilder sb)
s
- the ssb
- the sbpublic static final String escapeIfNecessary(String s)
s
- the spublic static final SqlExpression parseExpression(Object obj)
obj
- the objpublic static final SqlExpression[] parseExpressionArray(Object... objects)
objects
- the objectspublic static final SqlCondition parseCondition(Object object)
object
- the objectpublic static final String[] parseFullQualifiedTablename(String fullQualifiedTablename)
fullQualifiedTablename
- the full qualified tablenamepublic static final String assembleTimestamp(int... parts)
parts
- the partspublic static final String qualify(Object... parts)
parts
- the partsCopyright © 2003–2021 XDEV Software. All rights reserved.