|
|||||||||
| Home >> All >> org >> enableit >> [ db overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.enableit.db
Class DBUtils

java.lang.Objectorg.enableit.db.DBUtils
- public class DBUtils
- extends java.lang.Object
Provides utilities to be used in conjunction with the database proxies.
- Version:
- v1.1 Extracted the ResultSet conversion routines from the database proxies.
| Field Summary | |
static java.lang.String |
about
Information on the exact CVS version accessible after compilation |
static int |
DB_MSSQLSERVER
|
static java.lang.String |
DB_NAME_MSSQLSERVER
|
static java.lang.String |
DB_NAME_ORACLE
|
static java.lang.String |
DB_NAME_SYBASE_ASA
|
static java.lang.String |
DB_NAME_SYBASE_ASE
|
static int |
DB_ORACLE
|
static int |
DB_SYBASE_ASA
|
static int |
DB_SYBASE_ASE
|
static int |
DB_UNKNOWN
|
protected static org.apache.log4j.Category |
logger
The Log4J Category doing the logging. |
private static java.lang.String |
PROC_GET_NEXT_ID
Name of stored procedure used for getNextId |
private static java.lang.String |
SQL_GET_NEXT_ID
Dynamic SQL used for getNextId |
private static java.lang.String |
SQL_INIT_ID
Dynamic SQL used for getNextId, initialises the table if no previous query |
private static java.lang.String |
SQL_SET_NEXT_ID
Dynamic SQL used for getNextIdUsingSQL to update the id to the next one |
| Constructor Summary | |
DBUtils()
Default Constructor |
|
| Method Summary | |
static java.lang.String |
addFilter(java.lang.String sql,
DBFilter filter)
Adds a 'where' or 'and' clause as appropriate to join on the supplied column and value |
static java.lang.String |
addFilter(java.lang.String sql,
java.lang.String filterCol,
java.lang.String filterVal)
Adds a 'where' or 'and' clause as appropriate to join on the supplied column and value |
static java.lang.StringBuffer |
addFilters(java.lang.StringBuffer sql,
java.util.List filters)
Adds a 'where' or 'and' clause as appropriate to join on the supplied column and value |
static java.lang.String |
addFilters(java.lang.String sql,
java.util.List filters)
Adds a 'where' or 'and' clause as appropriate to join on the supplied column and value |
static java.sql.PreparedStatement |
bindVars(java.sql.PreparedStatement ps,
java.util.List parms)
Binds a List of varables into a SQL statement. |
static java.util.ArrayList |
convertHashMapToArrayList(java.util.HashMap attributes)
Converts a set of name-value pairs stored in a java.util.HashMap
to values only stored in a java.util.ArrayList |
static java.util.ArrayList |
convertHashtableToArrayList(java.util.Hashtable attributes)
Converts a set of name-value pairs stored in a java.util.Hashtable
to values only stored in a java.util.ArrayList |
static java.util.List |
convertResultToList(java.sql.ResultSet sqlResults)
Turns a ResultSet into an ArrayList
of TreeMaps |
static int |
getDatabaseProduct(java.sql.DatabaseMetaData dmd)
Return one of the enumerated database products. |
static int |
getNextId(java.lang.String tableName,
boolean spSupported)
Returns the next available id for the specified table |
static int |
getNextIdUsingSQL(java.lang.String tableName)
Returns the next available id for the specified table |
static java.lang.Object |
populateBean(java.lang.Object bean,
java.util.Map dataRecord)
Read data from a Map containing data according to the convention in convertResultToList and populate a JavaBean object with it. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
logger
protected static org.apache.log4j.Category logger
- The Log4J
Categorydoing the logging.
PROC_GET_NEXT_ID
private static final java.lang.String PROC_GET_NEXT_ID
- Name of stored procedure used for getNextId
- See Also:
- Constant Field Values
SQL_SET_NEXT_ID
private static final java.lang.String SQL_SET_NEXT_ID
- Dynamic SQL used for getNextIdUsingSQL to update the id to the next one
- See Also:
- Constant Field Values
SQL_GET_NEXT_ID
private static final java.lang.String SQL_GET_NEXT_ID
- Dynamic SQL used for getNextId
- See Also:
- Constant Field Values
SQL_INIT_ID
private static final java.lang.String SQL_INIT_ID
- Dynamic SQL used for getNextId, initialises the table if no previous query
- See Also:
- Constant Field Values
DB_UNKNOWN
public static final int DB_UNKNOWN
- See Also:
- Constant Field Values
DB_SYBASE_ASA
public static final int DB_SYBASE_ASA
- See Also:
- Constant Field Values
DB_SYBASE_ASE
public static final int DB_SYBASE_ASE
- See Also:
- Constant Field Values
DB_ORACLE
public static final int DB_ORACLE
- See Also:
- Constant Field Values
DB_MSSQLSERVER
public static final int DB_MSSQLSERVER
- See Also:
- Constant Field Values
DB_NAME_SYBASE_ASA
public static final java.lang.String DB_NAME_SYBASE_ASA
- See Also:
- Constant Field Values
DB_NAME_SYBASE_ASE
public static final java.lang.String DB_NAME_SYBASE_ASE
- See Also:
- Constant Field Values
DB_NAME_ORACLE
public static final java.lang.String DB_NAME_ORACLE
- See Also:
- Constant Field Values
DB_NAME_MSSQLSERVER
public static final java.lang.String DB_NAME_MSSQLSERVER
- See Also:
- Constant Field Values
about
public static final java.lang.String about
- Information on the exact CVS version accessible after compilation
- See Also:
- Constant Field Values
| Constructor Detail |
DBUtils
public DBUtils()
- Default Constructor
| Method Detail |
convertHashtableToArrayList
public static java.util.ArrayList convertHashtableToArrayList(java.util.Hashtable attributes)
- Converts a set of name-value pairs stored in a
java.util.Hashtableto values only stored in ajava.util.ArrayList
convertHashMapToArrayList
public static java.util.ArrayList convertHashMapToArrayList(java.util.HashMap attributes)
- Converts a set of name-value pairs stored in a
java.util.HashMapto values only stored in ajava.util.ArrayList
convertResultToList
public static java.util.List convertResultToList(java.sql.ResultSet sqlResults) throws DBException
- Turns a
ResultSetinto anArrayListofTreeMaps
getNextIdUsingSQL
public static int getNextIdUsingSQL(java.lang.String tableName) throws DBException
Returns the next available id for the specified table
The implementation makes use of a number fountain in the database to avoid the chance of two EJB onstances attempting to use the same key
getNextId
public static int getNextId(java.lang.String tableName, boolean spSupported) throws DBException
Returns the next available id for the specified table
The implementation makes use of a number fountain in the database to avoid the chance of two EJB onstances attempting to use the same key
addFilter
public static java.lang.String addFilter(java.lang.String sql, java.lang.String filterCol, java.lang.String filterVal)
Adds a 'where' or 'and' clause as appropriate to join on the supplied column and value
If filterCol and / or filterVal are null then no filter is added. This could be modified to allow joins to null values, but presents issues of what datatype to send to the database
addFilter
public static java.lang.String addFilter(java.lang.String sql, DBFilter filter)
Adds a 'where' or 'and' clause as appropriate to join on the supplied column and value
If filter name and / or filter value are null then no filter is added. This could be modified to allow joins to null values, but presents issues of what datatype to send to the database
addFilters
public static java.lang.String addFilters(java.lang.String sql, java.util.List filters)
Adds a 'where' or 'and' clause as appropriate to join on the supplied column and value
If filter name and / or filter value are null then no filter is added. This could be modified to allow joins to null values, but presents issues of what datatype to send to the database
addFilters
public static java.lang.StringBuffer addFilters(java.lang.StringBuffer sql, java.util.List filters)
Adds a 'where' or 'and' clause as appropriate to join on the supplied column and value
If filter name and / or filter value are null then no filter is added. This could be modified to allow joins to null values, but presents issues of what datatype to send to the database
populateBean
public static java.lang.Object populateBean(java.lang.Object bean, java.util.Map dataRecord) throws DBException
- Read data from a Map containing data according to the convention in
convertResultToListand populate a JavaBean object with it.
bindVars
public static java.sql.PreparedStatement bindVars(java.sql.PreparedStatement ps, java.util.List parms) throws DBException
- Binds a List of varables into a SQL statement.
getDatabaseProduct
public static int getDatabaseProduct(java.sql.DatabaseMetaData dmd)
- Return one of the enumerated database products.
|
|||||||||
| Home >> All >> org >> enableit >> [ db overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
org.enableit.db.DBUtils