Modifier and Type | Field and Description |
---|---|
static Level |
sSQLLoggingLevel |
Constructor and Description |
---|
SQLUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
close(Connection inConn) |
static void |
close(ResultSet inResultSet) |
static void |
close(Statement inStmt) |
static void |
closeResultSetAndStatement(ResultSet inResultSet) |
static boolean |
execute(Connection inConn,
String inSQL) |
static boolean |
execute(PreparedStatement inPreparedStatement) |
static boolean |
execute(Statement inStatement,
String inSQL) |
static ResultSet |
executeQuery(Connection inConn,
String inSQL) |
static ResultSet |
executeQuery(Connection inConn,
String inSQL,
SQLStatementOptions inOptions) |
static int |
executeQuery(PreparedStatement inPreparedStatement) |
static ResultSet |
executeQuery(Statement inStatement,
String inSQL) |
static int |
executeUpdate(Connection inConn,
String inSQL) |
static int |
executeUpdate(PreparedStatement inPreparedStatement) |
static int |
executeUpdate(Statement inStatement,
CharSequence inSQL) |
static Double |
getDouble(ResultSet inResultSet,
DatabaseCol inColumn) |
static Double |
getDouble(ResultSet inResultSet,
int inColumnIndex) |
static Double |
getDouble(ResultSet inResultSet,
String inColumnLabel) |
static Float |
getFloat(ResultSet inResultSet,
DatabaseCol inColumn) |
static Float |
getFloat(ResultSet inResultSet,
int inColumnIndex) |
static Float |
getFloat(ResultSet inResultSet,
String inColumnLabel) |
static Integer |
getInteger(ResultSet inResultSet,
DatabaseCol inColumn) |
static Integer |
getInteger(ResultSet inResultSet,
int inColumnIndex) |
static Integer |
getInteger(ResultSet inResultSet,
String inColumnLabel) |
static Logger |
getLogger() |
static Long |
getLong(ResultSet inResultSet,
DatabaseCol inColumn) |
static Long |
getLong(ResultSet inResultSet,
int inColumnIndex) |
static Long |
getLong(ResultSet inResultSet,
String inColumnLabel) |
static int |
getRowCount(Connection inConn,
DatabaseTable inTable,
Collection<SQLClause> inClauses)
A convenience method for getting a count of rows that meet a specific criteria.
|
static int |
getRowCount(Connection inConn,
DatabaseTable inTable,
WhereClause inWhereClause)
A convenience method for getting a count of rows that meet a specific criteria.
|
static void |
setDate(PreparedStatement inPreparedStatement,
int inIndex,
Date inValue)
A null-tolerant wrapper for PreparedStatement's setDate().
|
static void |
setDate(PreparedStatement inPreparedStatement,
int inIndex,
Date inValue)
A null-tolerant wrapper for PreparedStatement's setDate().
|
static void |
setDouble(PreparedStatement inPreparedStatement,
int inIndex,
Double inValue)
A null-tolerant wrapper for PreparedStatement's setDouble().
|
static void |
setFloat(PreparedStatement inPreparedStatement,
int inIndex,
Float inValue)
A null-tolerant wrapper for PreparedStatement's setFloat().
|
static void |
setInt(PreparedStatement inPreparedStatement,
int inIndex,
Integer inValue)
A null-tolerant wrapper for PreparedStatement's setInt().
|
static void |
setLong(PreparedStatement inPreparedStatement,
int inIndex,
Long inValue)
A null-tolerant wrapper for PreparedStatement's setLong().
|
static void |
setShort(PreparedStatement inPreparedStatement,
int inIndex,
Short inValue)
A null-tolerant wrapper for PreparedStatement's setShort().
|
static void |
setString(PreparedStatement inPreparedStatement,
int inIndex,
String inValue)
A null-tolerant wrapper for PreparedStatement's setString().
|
static void |
setTimestamp(PreparedStatement inPreparedStatement,
int inIndex,
Timestamp inValue)
A null-tolerant wrapper for PreparedStatement's setTimestamp().
|
static List<String> |
splitBatchSQL(Reader inSQL) |
static String |
sqlString(Object inValue) |
static String |
sqlString(String inValue) |
static String |
sqlStringList(Collection<? extends Object> inValues) |
static String |
sqlStringWithDoubleQuotes(String inValue)
All single and double quotes internal to the string are doubled for escaping.
|
public static Level sSQLLoggingLevel
public SQLUtil()
public static String sqlStringWithDoubleQuotes(String inValue)
inValue
- the value string to be escaped for single and double quotespublic static String sqlStringList(Collection<? extends Object> inValues)
public static boolean execute(Connection inConn, String inSQL) throws SQLException
SQLException
public static boolean execute(PreparedStatement inPreparedStatement) throws JDBCException
JDBCException
public static boolean execute(Statement inStatement, String inSQL) throws JDBCException
JDBCException
public static int executeUpdate(Connection inConn, String inSQL) throws SQLException
SQLException
public static int executeUpdate(PreparedStatement inPreparedStatement) throws SQLException
SQLException
public static int executeUpdate(Statement inStatement, CharSequence inSQL) throws SQLException
SQLException
public static ResultSet executeQuery(Connection inConn, String inSQL) throws SQLException
SQLException
public static ResultSet executeQuery(Connection inConn, String inSQL, SQLStatementOptions inOptions) throws SQLException
SQLException
public static int executeQuery(PreparedStatement inPreparedStatement) throws SQLException
SQLException
public static ResultSet executeQuery(Statement inStatement, String inSQL) throws JDBCException
JDBCException
public static void closeResultSetAndStatement(ResultSet inResultSet) throws JDBCException
JDBCException
public static void close(ResultSet inResultSet) throws JDBCException
JDBCException
public static void close(Statement inStmt) throws JDBCException
JDBCException
public static void close(Connection inConn) throws JDBCException
JDBCException
public static List<String> splitBatchSQL(Reader inSQL) throws IOException
IOException
public static Integer getInteger(ResultSet inResultSet, String inColumnLabel) throws SQLException
SQLException
public static Integer getInteger(ResultSet inResultSet, DatabaseCol inColumn) throws SQLException
SQLException
public static Integer getInteger(ResultSet inResultSet, int inColumnIndex) throws SQLException
SQLException
public static Long getLong(ResultSet inResultSet, String inColumnLabel) throws SQLException
SQLException
public static Long getLong(ResultSet inResultSet, DatabaseCol inColumn) throws SQLException
SQLException
public static Long getLong(ResultSet inResultSet, int inColumnIndex) throws SQLException
SQLException
public static Float getFloat(ResultSet inResultSet, String inColumnLabel) throws SQLException
SQLException
public static Float getFloat(ResultSet inResultSet, DatabaseCol inColumn) throws SQLException
SQLException
public static Float getFloat(ResultSet inResultSet, int inColumnIndex) throws SQLException
SQLException
public static Double getDouble(ResultSet inResultSet, String inColumnLabel) throws SQLException
SQLException
public static Double getDouble(ResultSet inResultSet, DatabaseCol inColumn) throws SQLException
SQLException
public static Double getDouble(ResultSet inResultSet, int inColumnIndex) throws SQLException
SQLException
public static void setString(PreparedStatement inPreparedStatement, int inIndex, String inValue) throws SQLException
inPreparedStatement
- the PreparedStatement in which to set the valueinIndex
- the parameter index where the value should be placedinValue
- the value to insert into the PreparedStatementSQLException
public static void setFloat(PreparedStatement inPreparedStatement, int inIndex, Float inValue) throws SQLException
inPreparedStatement
- the PreparedStatement in which to set the valueinIndex
- the parameter index where the value should be placedinValue
- the value to insert into the PreparedStatementSQLException
public static void setDouble(PreparedStatement inPreparedStatement, int inIndex, Double inValue) throws SQLException
inPreparedStatement
- the PreparedStatement in which to set the valueinIndex
- the parameter index where the value should be placedinValue
- the value to insert into the PreparedStatementSQLException
public static void setInt(PreparedStatement inPreparedStatement, int inIndex, Integer inValue) throws SQLException
inPreparedStatement
- the PreparedStatement in which to set the valueinIndex
- the parameter index where the value should be placedinValue
- the value to insert into the PreparedStatementSQLException
public static void setShort(PreparedStatement inPreparedStatement, int inIndex, Short inValue) throws SQLException
inPreparedStatement
- the PreparedStatement in which to set the valueinIndex
- the parameter index where the value should be placedinValue
- the value to insert into the PreparedStatementSQLException
public static void setLong(PreparedStatement inPreparedStatement, int inIndex, Long inValue) throws SQLException
inPreparedStatement
- the PreparedStatement in which to set the valueinIndex
- the parameter index where the value should be placedinValue
- the value to insert into the PreparedStatementSQLException
public static void setDate(PreparedStatement inPreparedStatement, int inIndex, Date inValue) throws SQLException
inPreparedStatement
- the PreparedStatement in which to set the valueinIndex
- the parameter index where the value should be placedinValue
- the value to insert into the PreparedStatementSQLException
public static void setDate(PreparedStatement inPreparedStatement, int inIndex, Date inValue) throws SQLException
inPreparedStatement
- the PreparedStatement in which to set the valueinIndex
- the parameter index where the value should be placedinValue
- the value to insert into the PreparedStatementSQLException
public static void setTimestamp(PreparedStatement inPreparedStatement, int inIndex, Timestamp inValue) throws SQLException
inPreparedStatement
- the PreparedStatement in which to set the valueinIndex
- the parameter index where the value should be placedinValue
- the value to insert into the PreparedStatementSQLException
public static int getRowCount(Connection inConn, DatabaseTable inTable, WhereClause inWhereClause) throws SQLException
inConn
- the database connectioninTable
- the database tableinWhereClause
- the where clause to useSQLException
public static int getRowCount(Connection inConn, DatabaseTable inTable, Collection<SQLClause> inClauses) throws SQLException
inConn
- the database connectioninTable
- the database tableinClauses
- additional clauses to useSQLException