|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.objectwave.persist.broker.RDBConnection
A connection to the database. Used by the connection pool and the RDBBroker. A not null value for the system property ow.persistConnectionVerbose will result in details of the SQL being sent over this connection to be logged. There will only ever be one thread operating on a single instance of an RDBConnection. A violation of that assumption will destroy the thread safety of this class.
Field Summary | |
protected int |
cachedCount
|
protected SqlStatementCacheItem[] |
cachedStatements
|
protected java.sql.Statement |
cachedUpdateStmt
|
protected java.sql.Connection |
connection
|
protected SqlConnectionFactory |
connectionSource
|
protected java.lang.String |
connectUrl
|
protected static boolean |
doInsert
|
protected static java.lang.String |
insrtProp
|
protected boolean |
inTransaction
|
protected GrinderResultSet |
lastResultSet
|
protected static boolean |
manageTransaction
If manageTransaction is false, no commit or rollback calls will ever be made. |
protected static boolean |
metrics
|
protected static java.lang.String |
metricsProp
|
protected boolean |
needsExplicitBegin
|
protected java.lang.Object[] |
objArrays
|
protected java.lang.String |
password
|
protected RDBConnectionPool |
pool
|
protected ObjectPoolBroker |
poolBroker
|
static int |
sqlStatementCount
Description of the Field |
protected boolean |
supportsTransaction
|
protected java.lang.Thread |
thread
|
protected java.lang.String |
userName
|
protected static boolean |
verbose
|
protected static java.lang.String |
verbProp
|
Method Summary | |
protected void |
addStatement(SQLModifier modifier,
java.lang.Class persistenceClass,
java.sql.PreparedStatement stmt)
Add a prepared statement to this connection's path. |
void |
alterVendorConnection(java.sql.Connection con)
Callback hook from connectionSource to allow vendor specific modification to the connection object. |
void |
beginTransaction()
If the database supports transactions this method would begin the transaction. |
protected java.sql.Connection |
checkConnection()
Verify that there is already a connection to the relational database. |
protected void |
clearConnection()
Only in the event of a very bad thing should this method be invoked. |
void |
commit()
Issues a database Commit. |
void |
execSql(java.lang.String aString)
Execute and finish. |
java.util.List |
executeQuery(java.lang.String aString,
int numberOfColumns)
Execute and finish. |
protected void |
finalize()
Disconnect from database if not already done. |
GrinderResultSet |
findExecSql(SQLAssembler sqlObj)
Used for executing any sql query statement. |
GrinderResultSet |
findExecSql(SQLAssembler sqlObj,
boolean release)
Used for executing any sql query statement. |
void |
freeConnection()
Every connection is associated with a particular thread. |
java.sql.DatabaseMetaData |
getDatabaseMetaData()
|
protected SqlConnectionFactory |
getDefaultConnectionSource()
|
GrinderResultSet |
getLastResultSet()
Gets the LastResultSet attribute of the RDBConnection object |
protected java.lang.Object[] |
getObjectArrays()
|
ObjectPoolBroker |
getObjectPoolBroker()
Every connection may end up manipulating the ObjectPool. |
protected RDBConnectionPool |
getPool()
The associated connection pool of which this connection is a member. |
java.lang.Thread |
getThread()
Get the thread that is currently related to this connection. |
void |
initialize(RDBConnectionPool pool,
java.lang.String connectUrl,
java.lang.String userName,
java.lang.String password)
|
boolean |
isInTransaction()
|
int |
nextPrimaryKey(SQLSelect sqlA)
|
void |
preparedUpdateSql(SQLModifier sqlObj,
Persistence pObj)
Execute java.sql.PreparedStatement code, perhaps creating the PreparedStatement object in the process. |
void |
rollback()
Issues a database rollback. |
void |
setBrokerProperty(BrokerPropertyIF b)
The ability to support properties other than System.getProperties(); |
protected void |
setConnection(java.sql.Connection newValue)
Change the connection to the new value. |
void |
setConnectionSource(SqlConnectionFactory factory)
Allow brokers to change the connection factory. |
void |
setObjectPoolBroker(ObjectPoolBroker broker)
If the framework is using an object pool in conjunction with the database, we need to support transactional access to that object pool. |
protected void |
setThread(java.lang.Thread t)
|
protected boolean |
tryAgain(int errorCode)
There may be error codes that mean the connection should simply try the statement a second time. |
void |
updateExecSql(SQLAssembler sqlObj)
Issue an update statement. |
protected void |
updateStatement(java.sql.PreparedStatement stmt)
Usually a no op. |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static int sqlStatementCount
protected static final java.lang.String verbProp
protected static final java.lang.String insrtProp
protected static final java.lang.String metricsProp
protected static boolean verbose
protected static boolean doInsert
protected static boolean manageTransaction
protected static boolean metrics
protected SqlConnectionFactory connectionSource
protected java.lang.String userName
protected java.lang.String password
protected java.lang.String connectUrl
protected java.sql.Connection connection
protected boolean inTransaction
protected boolean supportsTransaction
protected boolean needsExplicitBegin
protected java.lang.Thread thread
protected RDBConnectionPool pool
protected ObjectPoolBroker poolBroker
protected final java.lang.Object[] objArrays
protected GrinderResultSet lastResultSet
protected SqlStatementCacheItem[] cachedStatements
protected int cachedCount
protected java.sql.Statement cachedUpdateStmt
Method Detail |
public void setConnectionSource(SqlConnectionFactory factory)
factory
- The new ConnectionSource valuepublic void setObjectPoolBroker(ObjectPoolBroker broker)
broker
- The new ObjectPoolBroker valuepublic void setBrokerProperty(BrokerPropertyIF b)
b
- BrokerPropertyIF The source from which to determine broker
properties.protected void setThread(java.lang.Thread t)
t
- java.lang.Threadprotected void setConnection(java.sql.Connection newValue)
newValue
- The new Connection valuepublic ObjectPoolBroker getObjectPoolBroker()
public java.sql.DatabaseMetaData getDatabaseMetaData() throws java.sql.SQLException
java.sql.SQLException
- Description of Exceptionpublic java.lang.Thread getThread()
public GrinderResultSet getLastResultSet()
public boolean isInTransaction()
protected SqlConnectionFactory getDefaultConnectionSource()
protected java.lang.Object[] getObjectArrays()
protected RDBConnectionPool getPool()
public void beginTransaction() throws java.sql.SQLException
java.sql.SQLException
- Description of Exceptionpublic void commit() throws java.sql.SQLException
java.sql.SQLException
- Description of Exceptionpublic void execSql(java.lang.String aString) throws java.sql.SQLException
aString
- Description of Parameter
java.sql.SQLException
- Description of Exceptionpublic java.util.List executeQuery(java.lang.String aString, int numberOfColumns) throws java.sql.SQLException
aString
- Description of ParameternumberOfColumns
-
java.sql.SQLException
- Description of Exceptionpublic void rollback() throws java.sql.SQLException
java.sql.SQLException
- Description of Exceptionpublic void freeConnection()
com.objectwave.persist.RDBConnectionPool
public void alterVendorConnection(java.sql.Connection con) throws java.sql.SQLException
con
-
java.sql.SQLException
public void initialize(RDBConnectionPool pool, java.lang.String connectUrl, java.lang.String userName, java.lang.String password)
pool
- connectUrl
- userName
- password
- protected void clearConnection()
protected void addStatement(SQLModifier modifier, java.lang.Class persistenceClass, java.sql.PreparedStatement stmt)
modifier
- com.objectwave.persist.SQLModifierstmt
- java.sql.PreparedStatementpersistenceClass
- The feature to be added to the Statement attributeprotected void finalize() throws java.sql.SQLException
finalize
in class java.lang.Object
java.sql.SQLException
- Description of Exceptionpublic GrinderResultSet findExecSql(SQLAssembler sqlObj) throws java.sql.SQLException, QueryException
sqlObj
- Description of Parameter
java.sql.SQLException
- Description of Exception
QueryException
- Description of Exceptionpublic GrinderResultSet findExecSql(SQLAssembler sqlObj, boolean release) throws java.sql.SQLException, QueryException
sqlObj
- Description of Parameterrelease
- Description of Parameter
java.sql.SQLException
- Description of Exception
QueryException
- Description of Exceptionpublic void preparedUpdateSql(SQLModifier sqlObj, Persistence pObj) throws java.sql.SQLException, QueryException
sqlObj
- Description of ParameterpObj
- Description of Parameter
java.sql.SQLException
- Description of Exception
QueryException
- Description of Exceptionpublic void updateExecSql(SQLAssembler sqlObj) throws QueryException, java.sql.SQLException
sqlObj
- Description of Parameter
QueryException
- Description of Exception
java.sql.SQLException
- Description of Exceptionprotected boolean tryAgain(int errorCode)
errorCode
- Description of Parameter
protected void updateStatement(java.sql.PreparedStatement stmt)
stmt
- java.sql.PreparedStatementpublic int nextPrimaryKey(SQLSelect sqlA) throws java.sql.SQLException, QueryException
sqlA
- Description of Parameter
java.sql.SQLException
- Description of Exception
QueryException
- Description of Exceptionprotected java.sql.Connection checkConnection() throws java.sql.SQLException
java.sql.SQLException
- Description of Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |