public class DatabaseAccessor extends DatasourceAccessor
DatabaseAccessor also defines a single reference through which all configuration dependent behavior may be invoked.
DabaseAccessor implements the following behavior.
DatabasePlatform| Modifier and Type | Field and Description |
|---|---|
static boolean |
shouldUseDynamicStatements
PERF: Backdoor to disabling dynamic statements.
|
READ_STATEMENTS_COUNT_PROPERTY, readStatementsCount, shouldCheckConnection, STOREDPROCEDURE_STATEMENTS_COUNT_PROPERTY, storedProcedureStatementsCount, WRITE_STATEMENTS_COUNT_PROPERTY, writeStatementsCount| Constructor and Description |
|---|
DatabaseAccessor() |
| Modifier and Type | Method and Description |
|---|---|
java.sql.Statement |
allocateDynamicStatement(java.sql.Connection connection)
Allocate a statement for dynamic SQL execution.
|
void |
basicBeginTransaction(AbstractSession session)
Begin a transaction on the database.
|
void |
basicCommitTransaction(AbstractSession session)
Commit a transaction on the database.
|
java.lang.Object |
basicExecuteCall(Call call,
AbstractRecord translationRow,
AbstractSession session)
Execute the call.
|
void |
basicRollbackTransaction(AbstractSession session)
Rollback a transaction on the database.
|
AbstractRecord |
buildOutputRow(java.sql.CallableStatement statement,
DatabaseCall call,
AbstractSession session)
Build a row from the output parameters of a sp call.
|
java.util.Vector |
buildSortedFields(java.util.Vector fields,
java.sql.ResultSet resultSet,
AbstractSession session)
Return the field sorted in the correct order corresponding to the result set.
|
void |
clearStatementCache(AbstractSession session)
Flush the statement cache.
|
java.lang.Object |
clone()
Clone the accessor.
|
void |
closeConnection()
Close the accessor's connection.
|
void |
closeCursor(java.sql.ResultSet resultSet,
AbstractSession session)
Close the result set of the cursored stream.
|
void |
closeDatasourceConnection()
Close the connection.
|
void |
closeStatement(java.sql.Statement statement,
AbstractSession session,
DatabaseCall call)
INTERNAL:
Closes a PreparedStatement (which is supposed to close it's current resultSet).
|
void |
commitTransaction(AbstractSession session)
Commit a transaction on the database.
|
AbstractRecord |
cursorRetrieveNextRow(java.util.Vector fields,
java.sql.ResultSet resultSet,
AbstractSession session)
Advance the result set and return a Record populated
with values from the next valid row in the result set.
|
AbstractRecord |
cursorRetrievePreviousRow(java.util.Vector fields,
java.sql.ResultSet resultSet,
AbstractSession session)
Advance the result set and return a DatabaseRow populated
with values from the next valid row in the result set.
|
void |
disconnect(AbstractSession session)
Disconnect from the datasource.
|
java.lang.Object |
executeCall(Call call,
AbstractRecord translationRow,
AbstractSession session)
Execute the call.
|
java.lang.Integer |
executeDirectNoSelect(java.sql.Statement statement,
DatabaseCall call,
AbstractSession session)
Execute the statement.
|
java.sql.ResultSet |
executeSelect(DatabaseCall call,
java.sql.Statement statement,
AbstractSession session)
Execute the statement.
|
void |
flushSelectCalls(AbstractSession session)
Execute any deferred select calls stored in the LOBValueWriter instance.
|
BatchWritingMechanism |
getActiveBatchWritingMechanism()
INTERNAL:
This method is used internally to return the active batch writing mechanism to batch the statement
|
java.util.Vector |
getColumnInfo(java.lang.String catalog,
java.lang.String schema,
java.lang.String tableName,
java.lang.String columnName,
AbstractSession session)
Get a description of table columns available in a catalog.
|
java.sql.Connection |
getConnection()
Return the receiver's connection to its data source.
|
java.sql.DatabaseMetaData |
getConnectionMetaData()
return the cached metaData
|
LOBValueWriter |
getLOBWriter()
Return the LOBValueWriter instance.
|
java.lang.Object |
getObject(java.sql.ResultSet resultSet,
DatabaseField field,
java.sql.ResultSetMetaData metaData,
int columnNumber,
DatabasePlatform platform,
boolean optimizeData,
AbstractSession session)
Return an object retrieved from resultSet with the getObject() method.
|
DatabasePlatform |
getPlatform()
Return the platform.
|
java.util.Vector |
getTableInfo(java.lang.String catalog,
java.lang.String schema,
java.lang.String tableName,
java.lang.String[] types,
AbstractSession session)
Get a description of tables available in a catalog.
|
boolean |
isDatasourceConnected()
Return true if the receiver is currently connected to a data source.
|
boolean |
isDynamicStatementInUse()
Return the cached statement for dynamic SQL execution is in use.
|
java.sql.Statement |
prepareStatement(DatabaseCall call,
AbstractSession session)
Prepare the SQL statement for the call.
|
java.sql.Statement |
prepareStatement(DatabaseCall call,
AbstractSession session,
boolean unwrapConnection)
Prepare the SQL statement for the call.
|
DatabaseException |
processExceptionForCommError(AbstractSession session,
java.sql.SQLException exception,
Call call)
This method is used to process an SQL exception and determine if the exception
should be passed on for further processing.
|
java.lang.Object |
processResultSet(java.sql.ResultSet resultSet,
DatabaseCall call,
java.sql.Statement statement,
AbstractSession session)
Fetch all the rows from the result set.
|
void |
releaseStatement(java.sql.Statement statement,
java.lang.String sqlString,
DatabaseCall call,
AbstractSession session)
Release the statement through closing it or putting it back in the statement cache.
|
void |
rollbackTransaction(AbstractSession session)
Rollback a transaction on the database.
|
void |
setActiveBatchWritingMechanismToDynamicSQL()
INTERNAL:
This method is used to set the active Batch Mechanism on the accessor
|
void |
setActiveBatchWritingMechanismToParameterizedSQL()
INTERNAL:
This method is used to set the active Batch Mechanism on the accessor
|
void |
setDatasourcePlatform(DatasourcePlatform platform)
Set the platform.
|
void |
setIsDynamicStatementInUse(boolean isDynamicStatementInUse)
Set if the cached statement for dynamic SQL execution is in use.
|
void |
setShouldUseThreadCursors(boolean shouldUseThreadCursors)
Set if thread cursors should be used for fetch the result row.
|
boolean |
shouldUseThreadCursors()
Return if thread cursors should be used for fetch the result row.
|
java.lang.String |
toString() |
void |
writesCompleted(AbstractSession session)
This method will be called after a series of writes have been issued to
mark where a particular set of writes has completed.
|
beginTransaction, closeJTSConnection, connect, createCustomizer, decrementCallCount, getCallCount, getDatasourceConnection, getDatasourcePlatform, getLogin, getPool, getReadStatementsCount, getSequencingCallback, getStoredProcedureStatementsCount, getWriteStatementsCount, incrementCallCount, isConnected, isInTransaction, isValid, reestablishConnection, releaseCustomizer, releaseCustomizer, reset, setIsValid, setPool, usesExternalConnectionPooling, usesExternalTransactionControllerpublic static boolean shouldUseDynamicStatements
public void flushSelectCalls(AbstractSession session)
flushSelectCalls in interface AccessorflushSelectCalls in class DatasourceAccessorLOBValueWriter,
DatasourceCallQueryMechanism.insertObject()public LOBValueWriter getLOBWriter()
LOBValueWriterpublic java.sql.Statement allocateDynamicStatement(java.sql.Connection connection)
throws java.sql.SQLException
java.sql.SQLExceptionpublic boolean isDynamicStatementInUse()
public void setDatasourcePlatform(DatasourcePlatform platform)
setDatasourcePlatform in class DatasourceAccessorpublic void setIsDynamicStatementInUse(boolean isDynamicStatementInUse)
public void basicBeginTransaction(AbstractSession session) throws DatabaseException
DatabaseExceptionpublic AbstractRecord buildOutputRow(java.sql.CallableStatement statement, DatabaseCall call, AbstractSession session) throws DatabaseException
DatabaseExceptionpublic java.util.Vector buildSortedFields(java.util.Vector fields,
java.sql.ResultSet resultSet,
AbstractSession session)
throws DatabaseException
DatabaseExceptionpublic void clearStatementCache(AbstractSession session)
public java.lang.Object clone()
clone in interface Accessorclone in class DatasourceAccessorpublic void closeCursor(java.sql.ResultSet resultSet,
AbstractSession session)
throws DatabaseException
DatabaseExceptionpublic void closeStatement(java.sql.Statement statement,
AbstractSession session,
DatabaseCall call)
throws java.sql.SQLException
java.sql.SQLExceptionpublic void commitTransaction(AbstractSession session) throws DatabaseException
commitTransaction in interface AccessorcommitTransaction in class DatasourceAccessorDatabaseExceptionpublic void basicCommitTransaction(AbstractSession session) throws DatabaseException
DatabaseExceptionpublic AbstractRecord cursorRetrieveNextRow(java.util.Vector fields, java.sql.ResultSet resultSet, AbstractSession session) throws DatabaseException
DatabaseExceptionpublic AbstractRecord cursorRetrievePreviousRow(java.util.Vector fields, java.sql.ResultSet resultSet, AbstractSession session) throws DatabaseException
DatabaseExceptionpublic void closeDatasourceConnection()
throws DatabaseException
DatabaseExceptionpublic void disconnect(AbstractSession session) throws DatabaseException
disconnect in interface Accessordisconnect in class DatasourceAccessorDatabaseExceptionpublic void closeConnection()
closeConnection in interface AccessorcloseConnection in class DatasourceAccessorpublic java.lang.Object executeCall(Call call, AbstractRecord translationRow, AbstractSession session) throws DatabaseException
executeCall in interface AccessorexecuteCall in class DatasourceAccessorDatabaseExceptionpublic java.lang.Object basicExecuteCall(Call call, AbstractRecord translationRow, AbstractSession session) throws DatabaseException
DatabaseExceptionpublic java.lang.Object processResultSet(java.sql.ResultSet resultSet,
DatabaseCall call,
java.sql.Statement statement,
AbstractSession session)
throws java.sql.SQLException
java.sql.SQLExceptionpublic java.lang.Integer executeDirectNoSelect(java.sql.Statement statement,
DatabaseCall call,
AbstractSession session)
throws DatabaseException
DatabaseExceptionpublic java.sql.ResultSet executeSelect(DatabaseCall call, java.sql.Statement statement, AbstractSession session) throws java.sql.SQLException
java.sql.SQLExceptionpublic BatchWritingMechanism getActiveBatchWritingMechanism()
public java.util.Vector getColumnInfo(java.lang.String catalog,
java.lang.String schema,
java.lang.String tableName,
java.lang.String columnName,
AbstractSession session)
throws DatabaseException
Only column descriptions matching the catalog, schema, table and column name criteria are returned. They are ordered by TABLE_SCHEM, TABLE_NAME and ORDINAL_POSITION.
Each column description has the following columns:
getColumnInfo in interface AccessorgetColumnInfo in class DatasourceAccessorcatalog - a catalog name; "" retrieves those without a
catalog; null means drop catalog name from the selection criteriaschemaPattern - a schema name pattern; "" retrieves those
without a schematableNamePattern - a table name patterncolumnNamePattern - a column name patternDatabaseExceptionpublic java.sql.Connection getConnection()
throws DatabaseException
getConnection in interface AccessorgetConnection in class DatasourceAccessorDatabaseExceptionConnectionpublic DatabasePlatform getPlatform()
public java.sql.DatabaseMetaData getConnectionMetaData()
throws java.sql.SQLException
java.sql.SQLExceptionpublic java.lang.Object getObject(java.sql.ResultSet resultSet,
DatabaseField field,
java.sql.ResultSetMetaData metaData,
int columnNumber,
DatabasePlatform platform,
boolean optimizeData,
AbstractSession session)
throws DatabaseException
DatabaseExceptionpublic java.util.Vector getTableInfo(java.lang.String catalog,
java.lang.String schema,
java.lang.String tableName,
java.lang.String[] types,
AbstractSession session)
throws DatabaseException
Only table descriptions matching the catalog, schema, table name and type criteria are returned. They are ordered by TABLE_TYPE, TABLE_SCHEM and TABLE_NAME.
Each table description has the following columns:
Note: Some databases may not return information for all tables.
getTableInfo in interface AccessorgetTableInfo in class DatasourceAccessorcatalog - a catalog name; "" retrieves those without a
catalog; null means drop catalog name from the selection criteriaschemaPattern - a schema name pattern; "" retrieves those
without a schematableNamePattern - a table name patterntypes - a list of table types to include; null returns all typesDatabaseExceptionpublic boolean isDatasourceConnected()
public boolean shouldUseThreadCursors()
public void setShouldUseThreadCursors(boolean shouldUseThreadCursors)
public java.sql.Statement prepareStatement(DatabaseCall call, AbstractSession session) throws java.sql.SQLException
java.sql.SQLExceptionpublic java.sql.Statement prepareStatement(DatabaseCall call, AbstractSession session, boolean unwrapConnection) throws java.sql.SQLException
unwrapConnection - boolean flag set to true to unwrap the connection before preparing the statement in the
case of a parameterized call.java.sql.SQLExceptionpublic DatabaseException processExceptionForCommError(AbstractSession session, java.sql.SQLException exception, Call call)
public void releaseStatement(java.sql.Statement statement,
java.lang.String sqlString,
DatabaseCall call,
AbstractSession session)
throws java.sql.SQLException
java.sql.SQLExceptionpublic void rollbackTransaction(AbstractSession session) throws DatabaseException
rollbackTransaction in interface AccessorrollbackTransaction in class DatasourceAccessorDatabaseExceptionpublic void basicRollbackTransaction(AbstractSession session) throws DatabaseException
DatabaseExceptionpublic void setActiveBatchWritingMechanismToParameterizedSQL()
public void setActiveBatchWritingMechanismToDynamicSQL()
public java.lang.String toString()
toString in class java.lang.Objectpublic void writesCompleted(AbstractSession session)
writesCompleted in interface AccessorwritesCompleted in class DatasourceAccessorEclipseLink 2.4.2, "build v20130514-5956486" API Reference