|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.enableit.db.DatabaseProxy
Proxy class to wrap database access in a simple form. The user
is required to provide their own Connection
Field Summary | |
static java.lang.String |
ABOUT
CVS info about this class and its current version |
static int |
LIST
Valid Object type for result set returns |
protected static org.apache.log4j.Category |
logger
The Log4J Category doing the logging. |
static int |
SQL_RESULT_SET
Valid Object type for result set returns. |
Constructor Summary | |
DatabaseProxy()
|
Method Summary | |
static int |
executeDmlProcedure(java.sql.Connection conn,
java.lang.String sp,
java.util.List parms)
Execute the supplied stored procedure against the supplied database connection. |
static java.util.ArrayList |
executeQuery(java.sql.Connection conn,
java.lang.String sql)
Execute the supplied SQL query against the supplied database connection. |
static java.lang.Object |
executeQuery(java.sql.Connection conn,
java.lang.String sql,
int returnType)
Deprecated. use executeQuery(conn:Connection, sql:String):
java.util.ArrayList instead |
static java.util.List |
executeQuery(java.sql.Connection conn,
java.lang.String sql,
java.util.List parms)
Execute the supplied SQL query against the supplied database connection. |
static java.lang.Object |
executeQueryProcedure(java.sql.Connection conn,
java.lang.String sp,
java.util.List parms,
int returnType)
Execute the supplied stored procedure against the supplied database connection. |
static int |
executeUpdate(java.sql.Connection conn,
java.lang.String sql)
Execute the supplied SQL update query against a the supplied database connection. |
static int |
executeUpdate(java.sql.Connection conn,
java.lang.String sql,
java.util.List parms)
Execute the supplied SQL update statement against a the supplied database connection. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int LIST
public static final int SQL_RESULT_SET
java.sql.ResultSet
the developer
must take care to ensure that the reference and the Connection
that created it are correctly closed to avoid a memory leak.
protected static org.apache.log4j.Category logger
Category
doing the logging.
Same Category
is used throughout the library.
public static final java.lang.String ABOUT
Constructor Detail |
public DatabaseProxy()
Method Detail |
public static java.util.ArrayList executeQuery(java.sql.Connection conn, java.lang.String sql) throws DBException
conn
- The database connection to usesql
- The SQL query to execute
java.util.ArrayList
, each
element of which is a java.util.TreeMap
holding a
single row of results
DBException
- If execution of the query failed.public static java.util.List executeQuery(java.sql.Connection conn, java.lang.String sql, java.util.List parms) throws DBException
conn
- The database connection to usesql
- The SQL query to executeparms
- List
containing parameters to insert in the sql statement.
java.util.ArrayList
, each
element of which is a java.util.TreeMap
holding a
single row of results
DBException
- If execution of the query failed.public static java.lang.Object executeQuery(java.sql.Connection conn, java.lang.String sql, int returnType) throws DBException
executeQuery(conn:Connection, sql:String):
java.util.ArrayList
instead
conn
- The database connection to usesql
- The SQL query to executereturnType
- The object type to convert the SQL results into
DBException
- If execution of the query failed.public static int executeUpdate(java.sql.Connection conn, java.lang.String sql) throws DBException
sql
- The SQL update to executeconn
- The database connection to use
DBException
- If execution of the update failed.public static int executeUpdate(java.sql.Connection conn, java.lang.String sql, java.util.List parms) throws java.sql.SQLException, DBException
This is preferred over executeUpdate(Connection,
String)
when parameters exist as it provides better
handling of data types and may be significantly faster on some RDBMS
(e.g. Oracle) as it permits caching of the parameterised
PreparedStatement
.
conn
- The database connection to usesql
- The SQL update to execute with parameters represented by ?parms
- List
containing parameters to insert in the sql statement
DBException
- If execution of the update failed.
java.sql.SQLException
public static int executeDmlProcedure(java.sql.Connection conn, java.lang.String sp, java.util.List parms) throws DBException
conn
- The database connection to usesp
- A string containing the stored procedure nameparms
- A java.util.List
of String parameters for the stored procedure
DBException
- If execution of the stored procedure failed.public static java.lang.Object executeQueryProcedure(java.sql.Connection conn, java.lang.String sp, java.util.List parms, int returnType) throws DBException
conn
- The database connection to usesp
- A string containing the stored procedure nameparms
- A java.util.List
of String parameters for the stored procedurereturnType
- One of the defined return types defined as constants within this class.
java.lang.Object
containing any rows found.
The Object
type is defined by the return type parameter
DBException
- If execution of the stored procedure failed.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |