public class DBServices
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Class and Description |
---|---|
static class |
DBServices.StoredProcedureResult |
static class |
DBServices.TransactionOnCloseConnection |
Modifier and Type | Field and Description |
---|---|
protected boolean |
audit |
protected java.util.List<StatementHolder> |
auditTrail |
protected java.lang.String |
cachedRowSetClassName |
protected BasicStatementCache |
cachedStatements |
protected boolean |
cacheStatements |
protected java.sql.CallableStatement |
callStatement |
protected static java.util.Map<java.lang.String,java.lang.Class<?>> |
classSubstitute |
protected boolean |
closeResultSet |
protected boolean |
closeStatementAfterExecute |
protected int |
concurrency |
protected java.sql.Connection |
connection |
protected boolean |
connectionClosed |
protected java.lang.String |
connectionId |
protected java.util.Properties |
connectionProperties |
protected Converter |
converter |
protected java.lang.String |
cursorName |
protected javax.sql.DataSource |
dataSource |
protected boolean |
escapeProcessing |
protected int |
fetchDirection |
protected int |
fetchSize |
protected int |
maxFieldSize |
protected int |
maxNumberOfParams |
protected int |
maxRows |
protected int |
maxRowsToProcessInTransaction |
protected int |
maxStatementCacheSize |
protected java.lang.String |
placeHolder |
protected java.sql.PreparedStatement |
preparedStatement |
protected DBServices.StoredProcedureResult |
processResult |
protected boolean |
processStoredProc |
protected boolean |
processWarnings |
protected int |
queryTimeout |
protected boolean |
readOnly |
protected boolean |
resetDataSource |
protected java.sql.ResultSet |
resultSet |
protected java.util.List<java.sql.ResultSet> |
resultSets |
protected int |
resultSetType |
protected int |
rowsAffectedInTransaction |
protected boolean |
setConnectionToNullOnRelease |
protected java.sql.Statement |
statement |
protected boolean |
tranInProcess |
protected DBServices.TransactionOnCloseConnection |
transactionOnCloseConnection |
protected java.util.List<DataHolder> |
warnings |
Constructor and Description |
---|
DBServices() |
Modifier and Type | Method and Description |
---|---|
protected void |
addCachedStatement(java.lang.String statementId,
java.sql.Statement statementToCache) |
void |
beginTran() |
java.util.List<DataHolder> |
calcAffectedRows(int[] batchUpdates) |
void |
clearStatementCache() |
protected void |
closeResults() |
void |
commitTran() |
protected void |
createStatement() |
int |
execute(java.lang.String sql) |
int |
execute(java.lang.String sql,
java.util.Collection params) |
int[] |
executeBatch(java.util.Collection<java.lang.String> batch) |
int[] |
executeBatch(java.lang.String sql,
java.util.Collection<java.util.Collection> batch) |
java.util.List |
executeStoredProcedure(java.lang.String sql,
Parameters params,
DBServices.StoredProcedureResult processResult) |
java.util.List<StatementHolder> |
getAuditTrail() |
java.lang.String |
getCachedRowSetClassName() |
java.util.Map<java.lang.String,java.lang.Class<?>> |
getClassSubstitute() |
int |
getConcurrency()
Getter for property concurrency.
|
java.sql.Connection |
getConnection()
Getter for property connection.
|
java.lang.String |
getConnectionId()
Getter for property connectionId.
|
java.util.Properties |
getConnectionProperties()
Getter for property connectionProperties.
|
Converter |
getConverter() |
java.sql.ResultSet |
getCurrentResultSet() |
java.util.List<java.sql.ResultSet> |
getCurrentResultSets() |
java.lang.String |
getCursorName() |
javax.sql.DataSource |
getDataSource()
Getter for property dataSource.
|
boolean |
getEscapeProcessing()
Getter for property escapeProcessing.
|
int |
getFetchDirection()
Getter for property fetchDirection.
|
int |
getFetchSize()
Getter for property fetchSize.
|
int |
getMaxFieldSize()
Getter for property maxFieldSize.
|
int |
getMaxNumberOfParams() |
int |
getMaxRows()
Getter for property maxRows.
|
int |
getMaxRowsToProcessInTransaction()
Getter for property maxRowsToProcessInTransaction.
|
int |
getMaxStatementCacheSize() |
java.lang.String |
getPlaceHolder() |
java.sql.PreparedStatement |
getPreparedStatement(java.lang.String sql,
java.util.Collection<?> params)
Getter for property preparedStatement.
|
DBServices.TransactionOnCloseConnection |
getProcessTransactionOnCloseConnection() |
int |
getQueryTimeout()
Getter for property queryTimeout.
|
java.sql.ResultSet |
getResultSet(java.lang.String sql)
Getter for property resultSet.
|
java.sql.ResultSet |
getResultSet(java.lang.String sql,
java.util.Collection<?> params) |
java.sql.ResultSet[] |
getResultSets(java.lang.String sql,
java.util.Collection<?> params) |
java.sql.ResultSet[] |
getResultSets(java.lang.String sql,
java.util.Collection<?> params,
int maxNumberOfParams,
java.lang.String placeHolder) |
int |
getResultSetType()
Getter for property resultSetType.
|
int |
getRowsAffectedInTransaction()
Getter for property rowsAffectedInTransaction.
|
java.sql.Statement |
getStatement(java.lang.String sql)
Getter for property statement.
|
java.util.List<DataHolder> |
getWarnings() |
boolean |
isAudit() |
boolean |
isCacheStatements() |
boolean |
isCloseResultSet() |
boolean |
isCloseStatementAfterExecute()
Getter for property closeStatementAfterExecute.
|
boolean |
isConnectionClosed()
Getter for property connectionClosed.
|
boolean |
isProcessWarnings() |
boolean |
isResetDataSource()
Getter for property resetDataSource.
|
boolean |
isSetConnectionToNullOnRelease() |
boolean |
isTranInProcess()
Getter for property tranInProcess.
|
void |
populateWarnings(java.sql.SQLWarning warn)
Make sure to read warnings before release()
|
protected void |
prepareStatement(java.lang.String sql) |
void |
release(boolean closeConnection) |
void |
rollbackTran() |
void |
setAudit(boolean audit) |
void |
setCachedRowSetClassName(java.lang.String cachedRowSetClassName) |
void |
setCacheStatements(boolean cacheStatements) |
void |
setCloseResultSet(boolean closeResultSet) |
void |
setCloseStatementAfterExecute(boolean closeStatementAfterExecute)
Setter for property closeStatementAfterExecute.
|
void |
setConcurrency(int concurrency)
Setter for property concurrency.
|
void |
setConnection(java.sql.Connection connection)
Setter for property connection.
|
protected void |
setConnectionClosed(boolean connectionClosed)
Setter for property connectionClosed.
|
void |
setConnectionId(java.lang.String connectionId)
Setter for property connectionId.
|
void |
setConnectionProperties(java.util.Properties connectionProperties)
Setter for property connectionProperties.
|
void |
setConverter(Converter converter) |
void |
setCursorName(java.lang.String cursorName) |
void |
setDataSource(javax.sql.DataSource dataSource)
Setter for property dataSource.
|
void |
setEscapeProcessing(boolean escapeProcessing)
Setter for property escapeProcessing.
|
void |
setFetchDirection(int fetchDirection)
Setter for property fetchDirection.
|
void |
setFetchSize(int fetchSize)
Setter for property fetchSize.
|
void |
setMaxFieldSize(int maxFieldSize)
Setter for property maxFieldSize.
|
void |
setMaxNumberOfParams(int maxNumberOfParams) |
void |
setMaxRows(int maxRows)
Setter for property maxRows.
|
void |
setMaxRowsToProcessInTransaction(int maxRowsToProcessInTransaction)
Setter for property maxRowsToProcessInTransaction.
|
void |
setMaxStatementCacheSize(int maxStatementCacheSize) |
void |
setPlaceHolder(java.lang.String placeHolder) |
void |
setPreparedStatement(java.sql.PreparedStatement preparedStatement)
Setter for property preparedStatement.
|
void |
setProcessWarnings(boolean processWarnings) |
void |
setQueryTimeout(int queryTimeout)
Setter for property queryTimeout.
|
void |
setResetDataSource(boolean resetDataSource)
Setter for property resetDataSource.
|
void |
setResultSet(java.sql.ResultSet resultSet)
Setter for property resultSet.
|
void |
setResultSetType(int resultSetType)
Setter for property resultSetType.
|
void |
setRowsAffectedInTransaction(int rowsAffectedInTransaction)
Setter for property rowsAffectedInTransaction.
|
void |
setSetConnectionToNullOnRelease(boolean setConnectionToNullOnRelease) |
void |
setStatement(java.sql.Statement statement)
Setter for property statement.
|
void |
setTranInProcess(boolean tranInProcess)
Setter for property tranInProcess.
|
void |
setTransactionOnCloseConnection(DBServices.TransactionOnCloseConnection transactionOnCloseConnection) |
protected boolean connectionClosed
protected boolean setConnectionToNullOnRelease
protected transient javax.sql.DataSource dataSource
protected transient java.sql.Connection connection
protected transient java.sql.Statement statement
protected transient java.sql.PreparedStatement preparedStatement
protected transient java.sql.CallableStatement callStatement
protected transient java.sql.ResultSet resultSet
protected java.util.Properties connectionProperties
protected java.lang.String cursorName
protected int maxFieldSize
protected int maxRows
protected int queryTimeout
protected int fetchDirection
protected int fetchSize
protected int resultSetType
protected int concurrency
protected boolean readOnly
protected boolean closeStatementAfterExecute
protected boolean escapeProcessing
protected boolean tranInProcess
protected boolean resetDataSource
protected boolean processWarnings
protected boolean processStoredProc
protected boolean closeResultSet
protected DBServices.TransactionOnCloseConnection transactionOnCloseConnection
protected int maxRowsToProcessInTransaction
protected int rowsAffectedInTransaction
protected java.lang.String connectionId
protected java.lang.String placeHolder
protected int maxNumberOfParams
protected transient java.util.List<java.sql.ResultSet> resultSets
protected java.util.List<DataHolder> warnings
protected DBServices.StoredProcedureResult processResult
protected Converter converter
protected boolean cacheStatements
protected int maxStatementCacheSize
protected java.lang.String cachedRowSetClassName
protected java.util.List<StatementHolder> auditTrail
protected boolean audit
protected BasicStatementCache cachedStatements
protected static final java.util.Map<java.lang.String,java.lang.Class<?>> classSubstitute
public java.sql.Connection getConnection() throws java.sql.SQLException
java.sql.SQLException
public void setConnection(java.sql.Connection connection)
connection
- New value of property connection.public javax.sql.DataSource getDataSource() throws java.sql.SQLException
java.sql.SQLException
public void setDataSource(javax.sql.DataSource dataSource)
dataSource
- New value of property dataSource.protected void prepareStatement(java.lang.String sql) throws java.sql.SQLException
java.sql.SQLException
public java.sql.PreparedStatement getPreparedStatement(java.lang.String sql, java.util.Collection<?> params) throws java.sql.SQLException
java.sql.SQLException
public void setPreparedStatement(java.sql.PreparedStatement preparedStatement)
preparedStatement
- New value of property preparedStatement.public java.sql.ResultSet getCurrentResultSet()
public java.util.List<java.sql.ResultSet> getCurrentResultSets()
public java.sql.ResultSet getResultSet(java.lang.String sql) throws java.sql.SQLException
java.sql.SQLException
public java.sql.ResultSet getResultSet(java.lang.String sql, java.util.Collection<?> params) throws java.sql.SQLException
java.sql.SQLException
public java.sql.ResultSet[] getResultSets(java.lang.String sql, java.util.Collection<?> params, int maxNumberOfParams, java.lang.String placeHolder) throws java.sql.SQLException
java.sql.SQLException
public java.sql.ResultSet[] getResultSets(java.lang.String sql, java.util.Collection<?> params) throws java.sql.SQLException
java.sql.SQLException
public java.util.List executeStoredProcedure(java.lang.String sql, Parameters params, DBServices.StoredProcedureResult processResult) throws java.sql.SQLException
java.sql.SQLException
public int[] executeBatch(java.lang.String sql, java.util.Collection<java.util.Collection> batch) throws java.sql.SQLException
java.sql.SQLException
public int[] executeBatch(java.util.Collection<java.lang.String> batch) throws java.sql.SQLException
java.sql.SQLException
public java.util.List<DataHolder> calcAffectedRows(int[] batchUpdates)
public int execute(java.lang.String sql) throws java.sql.SQLException
java.sql.SQLException
public int execute(java.lang.String sql, java.util.Collection params) throws java.sql.SQLException
java.sql.SQLException
public void setResultSet(java.sql.ResultSet resultSet)
resultSet
- New value of property resultSet.protected void createStatement() throws java.sql.SQLException
java.sql.SQLException
public java.sql.Statement getStatement(java.lang.String sql) throws java.sql.SQLException
java.sql.SQLException
protected void closeResults() throws java.sql.SQLException
java.sql.SQLException
public void setStatement(java.sql.Statement statement)
statement
- New value of property statement.public void release(boolean closeConnection) throws java.sql.SQLException
java.sql.SQLException
public void beginTran() throws java.sql.SQLException
java.sql.SQLException
public void commitTran() throws java.sql.SQLException
java.sql.SQLException
public void rollbackTran() throws java.sql.SQLException
java.sql.SQLException
public int getFetchSize()
public void setFetchSize(int fetchSize)
fetchSize
- New value of property fetchSize.public int getFetchDirection()
public void setFetchDirection(int fetchDirection)
fetchDirection
- New value of property fetchDirection.public int getQueryTimeout()
public void setQueryTimeout(int queryTimeout)
queryTimeout
- New value of property queryTimeout.public int getMaxRows()
public void setMaxRows(int maxRows)
maxRows
- New value of property maxRows.public int getMaxFieldSize()
public void setMaxFieldSize(int maxFieldSize)
maxFieldSize
- New value of property maxFieldSize.public boolean getEscapeProcessing()
public void setEscapeProcessing(boolean escapeProcessing)
escapeProcessing
- New value of property escapeProcessing.public int getResultSetType()
public void setResultSetType(int resultSetType)
resultSetType
- New value of property resultSetType.public int getConcurrency()
public void setConcurrency(int concurrency)
concurrency
- New value of property concurrency.public boolean isConnectionClosed()
protected void setConnectionClosed(boolean connectionClosed)
connectionClosed
- New value of property connectionClosed.public int getMaxRowsToProcessInTransaction()
public void setMaxRowsToProcessInTransaction(int maxRowsToProcessInTransaction) throws java.sql.SQLException
maxRowsToProcessInTransaction
- New value of property
maxRowsToProcessInTransaction.java.sql.SQLException
public int getRowsAffectedInTransaction()
public void setRowsAffectedInTransaction(int rowsAffectedInTransaction) throws java.sql.SQLException
rowsAffectedInTransaction
- New value of property
rowsAffectedInTransaction.java.sql.SQLException
public java.util.Properties getConnectionProperties()
public void setConnectionProperties(java.util.Properties connectionProperties)
connectionProperties
- New value of property connectionProperties.public boolean isCloseStatementAfterExecute()
public void setCloseStatementAfterExecute(boolean closeStatementAfterExecute)
closeStatementAfterExecute
- New value of property
closeStatementAfterExecute.public java.lang.String getConnectionId()
public void setConnectionId(java.lang.String connectionId)
connectionId
- New value of property connectionId.public boolean isTranInProcess()
public void setTranInProcess(boolean tranInProcess)
tranInProcess
- New value of property tranInProcess.public boolean isResetDataSource()
public void setResetDataSource(boolean resetDataSource)
resetDataSource
- New value of property resetDataSource.public java.lang.String getPlaceHolder()
public void setPlaceHolder(java.lang.String placeHolder)
public int getMaxNumberOfParams()
public void setMaxNumberOfParams(int maxNumberOfParams)
public java.util.List<DataHolder> getWarnings()
public void setProcessWarnings(boolean processWarnings)
public boolean isProcessWarnings()
public void populateWarnings(java.sql.SQLWarning warn)
warn
- public boolean isCacheStatements()
public void clearStatementCache()
public void setCacheStatements(boolean cacheStatements)
public int getMaxStatementCacheSize()
public void setMaxStatementCacheSize(int maxStatementCacheSize)
protected void addCachedStatement(java.lang.String statementId, java.sql.Statement statementToCache) throws java.sql.SQLException
java.sql.SQLException
public java.lang.String getCachedRowSetClassName()
public void setCachedRowSetClassName(java.lang.String cachedRowSetClassName)
public void setCloseResultSet(boolean closeResultSet)
public boolean isCloseResultSet()
public java.lang.String getCursorName()
public void setCursorName(java.lang.String cursorName)
public DBServices.TransactionOnCloseConnection getProcessTransactionOnCloseConnection()
public void setTransactionOnCloseConnection(DBServices.TransactionOnCloseConnection transactionOnCloseConnection)
public boolean isSetConnectionToNullOnRelease()
public void setSetConnectionToNullOnRelease(boolean setConnectionToNullOnRelease)
public boolean isAudit()
public void setAudit(boolean audit)
public java.util.List<StatementHolder> getAuditTrail()
public Converter getConverter()
public void setConverter(Converter converter)
public java.util.Map<java.lang.String,java.lang.Class<?>> getClassSubstitute()