Assetize

Maximo Java API · psdi.mbo

SqlFormat psdi.mbo.SqlFormat

SqlFormat is a Maximo class. It is in every release from 8.5 to 9.3, with 47 public and protected methods and 16 fields.

Using this class in Jython

Import and construct a utility

Formats Maximo SQL conditions with typed substitutions using object and attribute metadata. Bind values with setObject and use format(). Include the site where the object is site scoped. This formats a condition; it does not run a query.

from psdi.mbo import SqlFormat
where = SqlFormat("assetnum = :1 and siteid = :2")

Signature and hierarchy

public class SqlFormat

Extends: java.lang.Object.

2 direct subclasses in IBM's code.

Where Maximo uses it

No object, attribute, screen, service or cron task names SqlFormat directly. No internal method callers can be inferred from these registrations.

Upgrading

Nothing on SqlFormat was removed or moved between 8.5 and 9.3. No recorded removal is not a runtime compatibility guarantee; compare the exact source and target signatures.

Method context

setObject
Bind a typed value into a numbered SQL placeholder. The object and attribute supply type metadata; placeholder numbering starts at 1. where.setObject(1, "ASSET", "ASSETNUM", assetnum)
format
Produce the formatted SQL condition. Use the result with setWhere. Formatting alone does not query the database. condition = where.format()

Methods

Signatures across captured releases. Use Browse to filter to one version.

SignatureReleases
public SqlFormat(Locale, TimeZone, String)8.5–9.3
public SqlFormat(MboRemote, String)8.5–9.3
public SqlFormat(String)8.5–9.3
public SqlFormat(UserInfo, String)8.5–9.3
public SqlFormat appendStatement(String)8.5–9.3
public String expressionToQueryWhere()8.5–9.3
public String format()8.5–9.3
public String format(MboSetInfo, MboSetRemote)8.5–9.3
public String formatRaw()8.5–9.3
public String formatRaw(MboSetInfo, MboSetRemote)8.7–9.3
public static String getDateFunction(Date)8.5–9.3
public static String getDateHistogramFunction(String, String)8.5–9.3
public static Properties getDBProperties()8.5–9.3
public MXException getEncounteredError()8.5–9.3
public String getFieldValue(String, MboRemote, boolean, int)8.5–9.3
public String getFieldValue(String, MboRemote, boolean)8.5–9.3
public String getFieldValue(String, MboRemote)8.5–9.3
public static String getNullValueFunction(String, String)8.5–9.3
public static String getSQLString(String)8.5–9.3
public static String getTimeFunction(Date)8.5–9.3
public static String getTimestampFunction(Date)8.5–9.3
public static String getUpperFunction(String)8.5–9.3
public boolean hasNullBoundValue()8.5–9.3
public static boolean isStrReservedKey(String)8.5–9.3
public String limitInClause(String, String, int, boolean)8.5–9.3
public String limitInClause(String)8.5–9.3
public StringBuffer limitInClause(StringBuffer)8.5–9.3
public String resolveContent()8.5–9.3
public static String reverseSQLString(String)8.5–9.3
public void setBoolean(int, boolean)8.5–9.3
public void setBytes(int, byte[])8.5–9.3
public void setDate(int, Date)8.5–9.3
public static void setDBProperties(Properties)8.5–9.3
public void setDouble(int, double)8.5–9.3
public void setFloat(int, float)8.5–9.3
public void setIgnoreUnresolved(boolean)8.5–9.3
public void setInt(int, int)8.5–9.3
public void setLong(int, long)8.5–9.3
public void setNoSpaces(boolean)8.5–9.3
public void setObject(int, String, String, String)8.5–9.3
public void setObject(int, String, String)8.5–9.3
public void setRealNumericNulls(boolean)8.5–9.3
public void setString(int, String)8.7–9.3
public void setTime(int, Date)8.5–9.3
public void setTimestamp(int, Date)8.5–9.3
public String simpleFormat()8.5–9.3
public String validateFormat()8.5–9.3

From automation scripts

Formats Maximo SQL conditions with typed substitutions using object and attribute metadata.

Query an independent set with typed values

Action launch point · WORKORDER with ASSETNUM and SITEID · Jython

from psdi.server import MXServer
from psdi.mbo import SqlFormat

where = SqlFormat("assetnum = :1 and siteid = :2")
where.setObject(1, "ASSET", "ASSETNUM", mbo.getString("ASSETNUM"))
where.setObject(2, "ASSET", "SITEID", mbo.getString("SITEID"))
assets = MXServer.getMXServer().getMboSet("ASSET", mbo.getUserInfo())
try:
    assets.setWhere(where.format())
    assets.reset()
    asset = assets.getMbo(0)
    if asset is not None:
        service.log(asset.getString("DESCRIPTION"))
finally:
    try:
        assets.cleanup()
    finally:
        assets.close()

For IBM's description of each method, see IBM's Javadoc for Maximo and Manage.