public class SQLUtility
extends java.lang.Object
Constructor and Description |
---|
SQLUtility() |
Modifier and Type | Method and Description |
---|---|
static void |
doCall(java.sql.Connection con,
java.lang.String call)
Perform a call.
|
static void |
doSql(java.sql.Connection con,
java.util.List<java.lang.String> sqlList)
Execute SQL
|
static void |
doSql(java.sql.Connection con,
java.util.List<java.lang.String> sqlList,
boolean ignoreError)
Execute a number of lines of SQL, with option of suppressing an error thrown.
|
static void |
doSql(java.sql.Connection dc,
SQLSpecificTransform sqlTransform,
java.lang.String... sql)
Execute a group of SQL statements.
|
static int |
doSql(java.sql.Connection dc,
SQLSpecificTransform transform,
java.lang.String sql)
Transform the SQL and then perform it.
|
static int |
doSql(java.sql.Connection con,
java.lang.String sql)
Execute SQL
|
static int |
doSql(java.sql.Connection con,
java.lang.String sql,
boolean ignoreError)
Execute a single line of SQL, with option of suppressing an error thrown.
|
static int |
doSql(java.sql.Connection con,
java.lang.String sql,
java.lang.String... params)
Execute SQL with string parameters.
|
static boolean |
exists(java.sql.Connection dc,
java.lang.String query)
Returns if any rows were selected by the query.
|
static boolean |
existsPs(java.sql.Connection dc,
java.lang.String query,
java.lang.String... params)
Returns if any rows were selected by the query.
|
static java.util.List<java.lang.String> |
listAllStrings(java.sql.Connection dc,
java.lang.String query)
Returns all strings for the first column value returned.
|
static java.lang.String |
printQuery(java.sql.Connection dc,
java.lang.String query) |
static java.util.List<AttributeStorage> |
selectAll(java.sql.Connection dc,
java.lang.String query,
AttributeStorageDefinition retStoreDef)
Select data from all rows.
|
static AttributeStorage |
selectFirst(java.sql.Connection con,
java.lang.String query,
AttributeStorageDefinition asd)
Get data for the first row only.
|
static java.lang.Boolean |
selectFirstBoolean(java.sql.Connection con,
java.lang.String query)
Select the value as a Boolean, using the Maximo YORN definition,
where 1 is true and 0 is false.
|
static java.lang.Double |
selectFirstDouble(java.sql.Connection con,
java.lang.String query)
Select the value as a Double.
|
static java.lang.Integer |
selectFirstInteger(java.sql.Connection con,
java.lang.String query)
Select the value as an Integer.
|
static java.lang.Long |
selectFirstLong(java.sql.Connection con,
java.lang.String query)
Select the value as a Long.
|
static java.lang.String |
selectFirstString(java.sql.Connection dc,
java.lang.String query)
Select the value as a string.
|
static java.lang.String |
selectFirstStringPs(java.sql.Connection dc,
java.lang.String query,
java.lang.String... params)
Select the value as a string.
|
public static java.lang.String selectFirstString(java.sql.Connection dc, java.lang.String query) throws java.sql.SQLException
dc
- The connection to query.query
- The queryjava.sql.SQLException
public static java.lang.String selectFirstStringPs(java.sql.Connection dc, java.lang.String query, java.lang.String... params) throws java.sql.SQLException
dc
- The connection to query.query
- The queryparams
- Optional string parametersjava.sql.SQLException
public static java.util.List<java.lang.String> listAllStrings(java.sql.Connection dc, java.lang.String query) throws java.sql.SQLException
dc
- The connection to query.query
- The queryjava.sql.SQLException
public static int doSql(java.sql.Connection con, java.lang.String sql, boolean ignoreError) throws java.sql.SQLException
con
- The connection to use.sql
- The SQL statement to execute.ignoreError
- If true, any SQL exception will be caught and ignored.java.sql.SQLException
public static java.lang.Integer selectFirstInteger(java.sql.Connection con, java.lang.String query) throws java.sql.SQLException
dc
- The connection to query.query
- The queryjava.sql.SQLException
public static boolean exists(java.sql.Connection dc, java.lang.String query) throws java.sql.SQLException
dc
- The connectionquery
- The SQL queryjava.sql.SQLException
public static boolean existsPs(java.sql.Connection dc, java.lang.String query, java.lang.String... params) throws java.sql.SQLException
dc
- The connectionquery
- The SQL queryparams
- Values for replacement, optional, note that they are Strings.java.sql.SQLException
public static java.util.List<AttributeStorage> selectAll(java.sql.Connection dc, java.lang.String query, AttributeStorageDefinition retStoreDef) throws java.sql.SQLException
dc
- query
- retStoreDef
- java.sql.SQLException
public static void doSql(java.sql.Connection con, java.util.List<java.lang.String> sqlList, boolean ignoreError) throws java.sql.SQLException
con
- The connection to use.sqlList
- The SQL statements to execute.ignoreError
- If true, any SQL exception will be caught and ignored.java.sql.SQLException
public static void doSql(java.sql.Connection con, java.util.List<java.lang.String> sqlList) throws java.sql.SQLException
con
- sqlList
- java.lang.Exception
java.sql.SQLException
public static int doSql(java.sql.Connection con, java.lang.String sql) throws java.sql.SQLException
con
- sqlList
- java.sql.SQLException
public static int doSql(java.sql.Connection con, java.lang.String sql, java.lang.String... params) throws java.sql.SQLException
con
- sql
- params
- java.sql.SQLException
public static AttributeStorage selectFirst(java.sql.Connection con, java.lang.String query, AttributeStorageDefinition asd) throws java.sql.SQLException
con
- query
- asd
- java.sql.SQLException
public static java.lang.Boolean selectFirstBoolean(java.sql.Connection con, java.lang.String query) throws java.sql.SQLException
dc
- The connection to query.query
- The queryjava.sql.SQLException
public static int doSql(java.sql.Connection dc, SQLSpecificTransform transform, java.lang.String sql) throws java.sql.SQLException
dc
- sqlTransform
- string
- java.sql.SQLException
public static java.lang.Long selectFirstLong(java.sql.Connection con, java.lang.String query) throws java.sql.SQLException
con
- The connection to query.query
- The queryjava.sql.SQLException
public static void doSql(java.sql.Connection dc, SQLSpecificTransform sqlTransform, java.lang.String... sql) throws java.sql.SQLException
dc
- sqlTransform
- sql
- java.lang.Exception
java.sql.SQLException
public static void doCall(java.sql.Connection con, java.lang.String call) throws java.sql.SQLException
con
- Connectioncall
- Call statementjava.sql.SQLException
public static java.lang.Double selectFirstDouble(java.sql.Connection con, java.lang.String query) throws java.sql.SQLException
con
- The connection to query.query
- The queryjava.sql.SQLException
public static java.lang.String printQuery(java.sql.Connection dc, java.lang.String query) throws java.sql.SQLException
java.sql.SQLException