public class SqlFormat
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
APPNAME
Reserved keyword that is recognized by SqlFormat as the name of
the application that the current MBO belongs.
|
static java.lang.String |
DATE
Current date without the hour, minutes portion.
|
static java.lang.String |
DATETIME
Current datetime.
|
static java.lang.String |
DOMAINFILTERINGPREFIX
Reserved keyward that is recognized by SqlFormat as the start of domain filtering where clause.
|
static java.lang.String |
HOSTNAME
Reserved keyword that is recognized by SqlFormat as the url of the host.
|
static java.lang.String |
LOCALEPREFIX
Keyword to specify a locale override.
|
static java.lang.String |
MBONAME
Reserved keyword that is recognized by SqlFormat as the name of the current MBO.
|
static java.lang.String |
OLD_PREFIX |
static java.lang.String |
OWNER
Reserved keyword that is recognized by SqlFormat as owner object of the current MBO.
|
static java.lang.String |
OWNERNAME
Reserved keyword that is recognized by SqlFormat as the object name of the
owner MBO of the current MBO.
|
static java.lang.String |
PERSONID
Reserved keyword that is recognized by SqlFormat as the person id
of the logged in user
|
static java.lang.String |
SEQUENCE
Next value from sequence (maxsequence, native sequence depending on platform).
|
static java.lang.String |
SYNONYMLISTPREFIX |
static java.lang.String |
TIMEZONEPREFIX
Keyword to specify a timezone override.
|
static java.lang.String |
UNIQUEID
Reserved keyword that is recognized by SqlFormat as the unique id of the current MBO.
|
static java.lang.String |
USER
Reserved keyword that is recognized by SqlFormat as the user name of the loggied in
user.
|
Constructor and Description |
---|
SqlFormat(java.util.Locale locale,
java.util.TimeZone timeZone,
java.lang.String stmt)
Construct with the specified SQL statement or SQL snippet
using the specified locale and time zone information.
|
SqlFormat(MboRemote mr,
java.lang.String stmt)
Construct with the specified SQL statement or SQL snippet
using the specified mbo.
|
SqlFormat(java.lang.String stmt)
Construct with the specified SQL statement or SQL snippet.
|
SqlFormat(UserInfo uInfo,
java.lang.String stmt)
Construct with the specified SQL statement or SQL snippet
using the specified user info's locale and time zone information.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
expressionToQueryWhere()
Convert the expression to a query where clause.
|
java.lang.String |
format()
Format the SQL string to be a db specific string
|
java.lang.String |
format(MboSetInfo msi,
MboSetRemote set) |
java.lang.String |
formatRaw()
This is similar to @see format() except this method will pass any exceptions forward rather
than printing a stack trace to the console.
|
static java.lang.String |
getDateFunction(java.util.Date param)
Return a timestamp function for the databse.
|
static java.util.Properties |
getDBProperties()
Get a list of the database properties
|
MXException |
getEncounteredError() |
java.lang.String |
getFieldValue(java.lang.String field,
MboRemote mbo)
Return the value of a field in the correct SQL format.
|
java.lang.String |
getFieldValue(java.lang.String field,
MboRemote mbo,
boolean useLocale) |
java.lang.String |
getFieldValue(java.lang.String field,
MboRemote mbo,
boolean useLocale,
int indexAfter) |
static java.lang.String |
getNullValueFunction(java.lang.String param,
java.lang.String nullVal)
Return a NVL function for the database.
|
static java.lang.String |
getSQLString(java.lang.String s) |
static java.lang.String |
getTimeFunction(java.util.Date param)
Return a timestamp function for the databse.
|
static java.lang.String |
getTimestampFunction(java.util.Date param)
Return a timestamp function for the databse.
|
static java.lang.String |
getUpperFunction(java.lang.String param)
Returns the upper case fucntion for the database, with the
specified paramter placed appropriately in the function.
|
boolean |
hasNullBoundValue() |
static boolean |
isStrReservedKey(java.lang.String str)
Check if the given string is the reserved keywords.
|
java.lang.String |
resolveContent()
Resolves the variables within the string using the specified Mbo.
|
static java.lang.String |
reverseSQLString(java.lang.String s) |
void |
setBoolean(int col,
boolean val)
Set the specified parameter number to a boolean value
|
void |
setBytes(int col,
byte[] val)
Set the specified parameter number to a byte array value.
|
void |
setDate(int col,
java.util.Date val)
Set the specified parameter number to a date value.
|
static void |
setDBProperties(java.util.Properties p)
Set a list of database properties.
|
void |
setDouble(int col,
double val)
Set the specified parameter number to a double value.
|
void |
setFloat(int col,
float val)
Set the specified parameter number to an float value.
|
void |
setIgnoreUnresolved(boolean b)
Inform sqlformat that if there is unresolved bind variable, it will not throw exception during
format and the original string followed by colon will remain in the formated message.
|
void |
setInt(int col,
int val)
Set the specified parameter number to an int value.
|
void |
setLong(int col,
long val)
Set the specified parameter number to a long value.
|
void |
setNoSpaces(boolean b)
Tells makeString whether to add spaces around simpleReplacement strings
|
void |
setObject(int col,
java.lang.String type,
java.lang.String val)
Set the specified parameter to a value and have it translated based on the specified type.
|
void |
setObject(int col,
java.lang.String tbName,
java.lang.String colName,
java.lang.String val)
Set the specified parameter to a value and have it translated based on the specified table and column name.
|
void |
setRealNumericNulls(boolean b)
See
useRealNumericNulls . |
void |
setTime(int col,
java.util.Date val)
Set the specified parameter number to a Time value.
|
void |
setTimestamp(int col,
java.util.Date val)
Set the specified parameter number to a Timestamp value.
|
java.lang.String |
simpleFormat()
Return the string after a simple replacement of the bind variables.
|
java.lang.String |
validateFormat()
Use this method to validate a sql statement.
|
public static final java.lang.String OLD_PREFIX
public static final java.lang.String OWNER
public static final java.lang.String APPNAME
public static final java.lang.String MBONAME
public static final java.lang.String OWNERNAME
public static final java.lang.String PERSONID
public static final java.lang.String USER
public static final java.lang.String DATE
public static final java.lang.String DATETIME
public static final java.lang.String SEQUENCE
public static final java.lang.String HOSTNAME
public static final java.lang.String UNIQUEID
public static final java.lang.String DOMAINFILTERINGPREFIX
public static final java.lang.String SYNONYMLISTPREFIX
public static final java.lang.String TIMEZONEPREFIX
public static final java.lang.String LOCALEPREFIX
public SqlFormat(java.lang.String stmt)
public SqlFormat(java.util.Locale locale, java.util.TimeZone timeZone, java.lang.String stmt)
public SqlFormat(MboRemote mr, java.lang.String stmt)
public SqlFormat(UserInfo uInfo, java.lang.String stmt)
public boolean hasNullBoundValue()
public static java.util.Properties getDBProperties()
public static void setDBProperties(java.util.Properties p)
public static java.lang.String getUpperFunction(java.lang.String param)
public static java.lang.String getTimestampFunction(java.util.Date param)
public static java.lang.String getTimeFunction(java.util.Date param)
public static java.lang.String getNullValueFunction(java.lang.String param, java.lang.String nullVal)
public static java.lang.String getDateFunction(java.util.Date param)
public void setBoolean(int col, boolean val)
public void setLong(int col, long val)
public void setInt(int col, int val)
public void setFloat(int col, float val)
public void setDouble(int col, double val)
public void setDate(int col, java.util.Date val)
public void setTime(int col, java.util.Date val)
public void setTimestamp(int col, java.util.Date val)
public void setBytes(int col, byte[] val)
public void setObject(int col, java.lang.String tbName, java.lang.String colName, java.lang.String val) throws MXException, java.rmi.RemoteException
MXException
java.rmi.RemoteException
public void setObject(int col, java.lang.String type, java.lang.String val) throws MXException, java.rmi.RemoteException
type
- type is Maximo Type String constant, such as ALN, UPPER, DATE, etcMXException
java.rmi.RemoteException
public java.lang.String simpleFormat()
public java.lang.String validateFormat() throws MXException
MXException
public java.lang.String format()
public java.lang.String format(MboSetInfo msi, MboSetRemote set)
public java.lang.String formatRaw() throws MXException
MXException
public MXException getEncounteredError()
public java.lang.String getFieldValue(java.lang.String field, MboRemote mbo) throws MXException
MXException
public java.lang.String getFieldValue(java.lang.String field, MboRemote mbo, boolean useLocale) throws MXException
MXException
public java.lang.String getFieldValue(java.lang.String field, MboRemote mbo, boolean useLocale, int indexAfter) throws MXException
MXException
public void setNoSpaces(boolean b)
public void setRealNumericNulls(boolean b)
useRealNumericNulls
.b
- public static java.lang.String getSQLString(java.lang.String s)
public static java.lang.String reverseSQLString(java.lang.String s)
public java.lang.String resolveContent()
content
- MXException
java.rmi.RemoteException
public void setIgnoreUnresolved(boolean b)
public java.lang.String expressionToQueryWhere() throws MXException, java.rmi.RemoteException
MXException
java.rmi.RemoteException
public static boolean isStrReservedKey(java.lang.String str)
str
-