|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.lateralnz.common.util.DAOUtils
public class DAOUtils
utility functions for use with Data Access Objects and for more general JDBC stuff
| Field Summary |
|---|
| Fields inherited from interface org.lateralnz.common.util.Constants |
|---|
AMPERSAND, AND, APPLICATION_X_WWW_FORM_URLENCODED, ASTERISK, AT, BACK_SLASH, CHAR_LEFT_CHEV, CHAR_RIGHT_CHEV, COLON, COMMA, CRLF, DASH, DELETE, DOLLAR, DOT, DOT_CLASS, DOT_JAVA, EIGHT, EMPTY, EQUALS, FALSE, FILE_SEPARATOR, FIVE, FORWARD_SLASH, FOUR, FULLSTOP, HASH, HAT, INSERT, LEFT_BRACE, LEFT_BRACKET, LEFT_CHEV, MAX_LEN_APPCODE, MAX_LEN_APPGROUP, MAX_LEN_MSGCODE, MAX_LEN_MSGTEXT, MINUS_ONE, N, NEWLINE, NINE, NO, NULL_STRING, OFF, ON, ONE, ONE_DAY, ONE_HOUR, ONE_MINUTE, ONE_WEEK, PATH_SEPARATOR, PERCENT, PIPE, PLUS, QUESTION_MARK, QUOTE, REQUIRED, REQUIRES_NEW, RETURN, RIGHT_BRACE, RIGHT_BRACKET, RIGHT_CHEV, SELECT, SEMICOLON, SEVEN, SINGLE_QUOTE, SIX, SPACE, SQ_LEFT_BRACKET, SQ_RIGHT_BRACKET, SUPPORTS, TEXT_HTML, TEXT_PLAIN, TEXT_XML, THREE, TRUE, TWO, UNDERSCORE, UPDATE, UTF_8, Y, YES, ZERO |
| Constructor Summary | |
|---|---|
DAOUtils()
|
|
| Method Summary | |
|---|---|
static java.lang.String |
buildSQL(java.util.ResourceBundle sqlstatements,
java.lang.String[] keys)
|
static boolean |
close(java.sql.Connection conn)
|
static boolean |
close(java.sql.ResultSet rs)
|
static boolean |
close(java.sql.Statement st)
|
static boolean |
commit(java.sql.Connection conn)
|
static java.lang.String |
createParameterPlaceholders(int count)
|
static java.lang.String |
createSQLArrayString(java.lang.String[] vals,
int start,
int len)
|
static java.lang.String |
dump(java.sql.ResultSet rs)
|
static java.lang.String |
dumpData(java.sql.ResultSet rs)
|
static boolean |
getCharAsBoolean(java.sql.ResultSet rs,
java.lang.String column,
boolean defaultValue)
get a char(1) as a boolean value. |
static ColumnMetaData |
getColumnMetaData(java.sql.Connection conn,
java.lang.String schema,
java.lang.String table,
java.lang.String column)
return column meta data for a particular column using the specified connection. |
static java.sql.Connection |
getConnection(java.lang.String datasource)
get a connection from a named datasource using JNDI |
static java.util.Date |
getDate(java.sql.ResultSet rs,
java.lang.String columnName)
given a resultset and column name of a timestamp column, return the column as a java.util.Date |
static boolean |
hasColumnMetaData(java.lang.String schema,
java.lang.String table,
java.lang.String column)
a method for checking if column meta data has been cached for the specified schema, table and column name. |
static boolean |
isDuplicateKeyException(java.sql.SQLException se)
|
static boolean |
isDuplicateKeyException(java.lang.Throwable t)
|
static java.lang.String |
parseInClause(java.lang.String sql,
int numInList)
|
static void |
registerDriver(java.lang.String driverClass)
|
static void |
setParam(java.sql.PreparedStatement ps,
int col,
boolean value)
|
static void |
setParam(java.sql.PreparedStatement ps,
int col,
java.util.Date value)
set a Date parameter on a prepared statement according to its index. |
static void |
setParam(java.sql.PreparedStatement ps,
int col,
float value)
set a float parameter on a prepared statement according to its index. |
static void |
setParam(java.sql.PreparedStatement ps,
int col,
int value)
set an int parameter on a prepared statement according to its index. |
static void |
setParam(java.sql.PreparedStatement ps,
int col,
int value,
boolean preserve)
set an int parameter on a prepared statement according to its index. |
static void |
setParam(java.sql.PreparedStatement ps,
int col,
java.lang.String value)
set a String parameter on a prepared statement according to its index. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DAOUtils()
| Method Detail |
|---|
public static final java.lang.String buildSQL(java.util.ResourceBundle sqlstatements,
java.lang.String[] keys)
public static boolean commit(java.sql.Connection conn)
public static boolean close(java.sql.Statement st)
public static boolean close(java.sql.ResultSet rs)
public static boolean close(java.sql.Connection conn)
public static final java.lang.String createParameterPlaceholders(int count)
public static final java.lang.String createSQLArrayString(java.lang.String[] vals,
int start,
int len)
public static java.lang.String dump(java.sql.ResultSet rs)
public static java.lang.String dumpData(java.sql.ResultSet rs)
public static boolean getCharAsBoolean(java.sql.ResultSet rs,
java.lang.String column,
boolean defaultValue)
throws java.sql.SQLException
java.sql.SQLException
public static java.util.Date getDate(java.sql.ResultSet rs,
java.lang.String columnName)
throws java.sql.SQLException
java.sql.SQLException
public static boolean hasColumnMetaData(java.lang.String schema,
java.lang.String table,
java.lang.String column)
public static ColumnMetaData getColumnMetaData(java.sql.Connection conn,
java.lang.String schema,
java.lang.String table,
java.lang.String column)
throws java.sql.SQLException
java.sql.SQLException
public static java.sql.Connection getConnection(java.lang.String datasource)
throws java.sql.SQLException
datasource - the name of the data source to retrieve
java.sql.SQLExceptionpublic static boolean isDuplicateKeyException(java.lang.Throwable t)
public static boolean isDuplicateKeyException(java.sql.SQLException se)
public static final java.lang.String parseInClause(java.lang.String sql,
int numInList)
public static final void registerDriver(java.lang.String driverClass)
throws java.lang.Exception
java.lang.Exception
public static void setParam(java.sql.PreparedStatement ps,
int col,
java.lang.String value)
throws java.sql.SQLException
ps - the PreparedStatementcol - the index of the parametervalue - the string to set
java.sql.SQLException
public static void setParam(java.sql.PreparedStatement ps,
int col,
int value)
throws java.sql.SQLException
ps - the PreparedStatementcol - the index of the parametervalue - the int value to set
java.sql.SQLException
public static void setParam(java.sql.PreparedStatement ps,
int col,
int value,
boolean preserve)
throws java.sql.SQLException
ps - the PreparedStatementcol - the index of the parametervalue - the int value to setpreserveNegative - do not call setNull if this is true
java.sql.SQLException
public static void setParam(java.sql.PreparedStatement ps,
int col,
float value)
throws java.sql.SQLException
ps - the PreparedStatementcol - the index of the parametervalue - the float value to setpreserveNegative - do not call setNull if this is true
java.sql.SQLException
public static void setParam(java.sql.PreparedStatement ps,
int col,
java.util.Date value)
throws java.sql.SQLException
ps - the PreparedStatementcol - the index of the parametervalue - the date to set
java.sql.SQLException
public static void setParam(java.sql.PreparedStatement ps,
int col,
boolean value)
throws java.sql.SQLException
java.sql.SQLException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||