public class GenericDbmsSupport extends Object implements IDbmsSupport
Modifier and Type | Field and Description |
---|---|
protected static String |
KEYWORD_SELECT |
protected org.apache.logging.log4j.Logger |
log |
protected static Map<String,ISqlTranslator> |
sqlTranslators |
protected static String |
TYPE_BLOB |
protected static String |
TYPE_CLOB |
protected static String |
TYPE_FUNCTION |
Constructor and Description |
---|
GenericDbmsSupport() |
Modifier and Type | Method and Description |
---|---|
void |
applyBlobParameter(PreparedStatement stmt,
int column,
Object blobInsertHandle) |
void |
applyClobParameter(PreparedStatement stmt,
int column,
Object clobHandle) |
String |
autoIncrementInsertValue(String sequenceName) |
boolean |
autoIncrementKeyMustBeInserted() |
boolean |
autoIncrementUsesSequenceObject() |
void |
convertQuery(QueryExecutionContext queryExecutionContext,
String sqlDialectFrom) |
protected ISqlTranslator |
createTranslator(String source,
String target) |
protected boolean |
doHasIndexOnColumns(Connection conn,
String schemaOwner,
String tableName,
List<String> columns,
String indexTableName,
String indexColumnTableName,
String tableOwnerColumnName,
String tableNameColumnName,
String indexNameColumnName,
String columnNameColumnName,
String columPositionColumnName) |
protected boolean |
doIsColumnPresent(Connection conn,
String columnsTable,
String schemaColumn,
String tableNameColumn,
String columnNameColumn,
String schemaName,
String tableName,
String columnName)
Alternative implementation of isColumnPresent(), that can be used by descender classes if the implementation via metadata does not work for that driver.
|
protected boolean |
doIsTablePresent(Connection conn,
String tablesTable,
String schemaColumn,
String tableNameColumn,
String schemaName,
String tableName)
Alternative implementation of isTablePresent(), that can be used by descender classes if the implementation via metadata does not work for that driver.
|
String |
emptyBlobValue() |
String |
emptyClobValue() |
String |
getAutoIncrementKeyFieldType() |
String |
getBlobFieldType() |
Object |
getBlobHandle(PreparedStatement stmt,
int column) |
Object |
getBlobHandle(ResultSet rs,
int column) |
Object |
getBlobHandle(ResultSet rs,
String column) |
InputStream |
getBlobInputStream(ResultSet rs,
int column) |
InputStream |
getBlobInputStream(ResultSet rs,
String column) |
OutputStream |
getBlobOutputStream(PreparedStatement stmt,
int column,
Object blobInsertHandle) |
OutputStream |
getBlobOutputStream(ResultSet rs,
int column,
Object blobUpdateHandle) |
protected OutputStream |
getBlobOutputStream(ResultSet rs,
Object blobUpdateHandle) |
OutputStream |
getBlobOutputStream(ResultSet rs,
String column,
Object blobUpdateHandle) |
String |
getBooleanFieldType() |
String |
getBooleanValue(boolean value) |
String |
getCleanUpIbisstoreQuery(String tableName,
String keyField,
String typeField,
String expiryDateField,
int maxRows) |
String |
getClobFieldType() |
Object |
getClobHandle(PreparedStatement stmt,
int column) |
Object |
getClobHandle(ResultSet rs,
int column) |
Object |
getClobHandle(ResultSet rs,
String column) |
Reader |
getClobReader(ResultSet rs,
int column) |
Reader |
getClobReader(ResultSet rs,
String column) |
Writer |
getClobWriter(PreparedStatement stmt,
int column,
Object clobHandle) |
Writer |
getClobWriter(ResultSet rs,
int column,
Object clobHandle) |
Writer |
getClobWriter(ResultSet rs,
String column,
Object clobHandle) |
String |
getDateAndOffset(String dateValue,
int daysOffset) |
String |
getDatetimeLiteral(Date date) |
Dbms |
getDbms()
Numeric value defining database type, defined in
DbmsSupportFactory . |
String |
getDbmsName() |
String |
getFirstRecordQuery(String tableName) |
String |
getFromForTablelessSelect()
http://en.wikipedia.org/wiki/DUAL_table
|
String |
getIbisStoreSummaryQuery() |
String |
getInsertedAutoIncrementValueQuery(String sequenceName) |
String |
getLength(String column) |
String |
getNumericKeyFieldType() |
String |
getRowNumber(String order,
String sort) |
String |
getRowNumberShortName() |
String |
getSchema(Connection conn) |
String |
getSchemaOwner(Connection conn) |
String |
getSysDate()
SQL String returning current date and time of dbms.
|
ResultSet |
getTableColumns(Connection conn,
String tableName) |
ResultSet |
getTableColumns(Connection conn,
String schemaName,
String tableName) |
ResultSet |
getTableColumns(Connection conn,
String schemaName,
String tableName,
String columnNamePattern) |
String |
getTextFieldType() |
String |
getTimestampAsDate(String columnName) |
String |
getTimestampFieldType() |
String |
getUpdateBlobQuery(String table,
String blobField,
String keyField) |
String |
getUpdateClobQuery(String table,
String clobField,
String keyField) |
boolean |
hasIndexOnColumn(Connection conn,
String schemaName,
String tableName,
String columnName) |
boolean |
hasIndexOnColumns(Connection conn,
String schemaOwner,
String tableName,
List<String> columns) |
boolean |
hasSkipLockedFunctionality() |
boolean |
isBlobType(ResultSetMetaData rsmeta,
int colNum) |
boolean |
isClobType(ResultSetMetaData rsmeta,
int colNum) |
boolean |
isColumnPresent(Connection conn,
String tableName,
String columnName) |
boolean |
isColumnPresent(Connection conn,
String schemaName,
String tableName,
String columnName) |
boolean |
isConstraintViolation(SQLException e) |
boolean |
isIndexPresent(Connection conn,
String schemaOwner,
String tableName,
String indexName) |
boolean |
isParameterTypeMatchRequired() |
protected boolean |
isQueryConversionRequired(String sqlDialectFrom) |
boolean |
isSequencePresent(Connection conn,
String schemaOwner,
String tableName,
String sequenceName) |
boolean |
isTablePresent(Connection conn,
String tableName) |
boolean |
isTablePresent(Connection conn,
String schemaName,
String tableName) |
boolean |
mustInsertEmptyBlobBeforeData() |
boolean |
mustInsertEmptyClobBeforeData() |
String |
prepareQueryTextForNonLockingRead(String selectQuery)
Modify the provided selectQuery in such a way that the resulting query will not be blocked by locks, and will avoid placing locks itself as much as possible.
|
String |
prepareQueryTextForWorkQueuePeeking(int batchSize,
String selectQuery) |
String |
prepareQueryTextForWorkQueuePeeking(int batchSize,
String selectQuery,
int wait) |
String |
prepareQueryTextForWorkQueueReading(int batchSize,
String selectQuery) |
String |
prepareQueryTextForWorkQueueReading(int batchSize,
String selectQuery,
int wait) |
JdbcSession |
prepareSessionForNonLockingRead(Connection conn)
Modify the connection in such a way that it when select queries, prepared by
IDbmsSupport.prepareQueryTextForNonLockingRead(String) or by IDbmsSupport.prepareQueryTextForWorkQueuePeeking(int,String) ,
are executed, they will not be blocked by locks, and will avoid placing locks itself as much as possible. |
String |
provideFirstRowsHintAfterFirstKeyword(int rowCount) |
String |
provideIndexHintAfterFirstKeyword(String tableName,
String indexName) |
String |
provideTrailingFirstRowsHint(int rowCount) |
protected List<String> |
splitQuery(String query) |
void |
updateBlob(ResultSet rs,
int column,
Object blobUpdateHandle) |
void |
updateBlob(ResultSet rs,
String column,
Object blobUpdateHandle) |
void |
updateClob(ResultSet rs,
int column,
Object clobHandle) |
void |
updateClob(ResultSet rs,
String column,
Object clobHandle) |
protected void |
warnConvertQuery(String sqlDialectFrom) |
protected org.apache.logging.log4j.Logger log
protected static final String KEYWORD_SELECT
protected static final String TYPE_BLOB
protected static final String TYPE_CLOB
protected static final String TYPE_FUNCTION
protected static Map<String,ISqlTranslator> sqlTranslators
public String getDbmsName()
getDbmsName
in interface IDbmsSupport
public Dbms getDbms()
IDbmsSupport
DbmsSupportFactory
.getDbms
in interface IDbmsSupport
public boolean isParameterTypeMatchRequired()
isParameterTypeMatchRequired
in interface IDbmsSupport
public boolean hasSkipLockedFunctionality()
hasSkipLockedFunctionality
in interface IDbmsSupport
public String getSysDate()
IDbmsSupport
getSysDate
in interface IDbmsSupport
public String getDateAndOffset(String dateValue, int daysOffset)
getDateAndOffset
in interface IDbmsSupport
public String getNumericKeyFieldType()
getNumericKeyFieldType
in interface IDbmsSupport
public String getFromForTablelessSelect()
IDbmsSupport
getFromForTablelessSelect
in interface IDbmsSupport
public String getAutoIncrementKeyFieldType()
getAutoIncrementKeyFieldType
in interface IDbmsSupport
public boolean autoIncrementKeyMustBeInserted()
autoIncrementKeyMustBeInserted
in interface IDbmsSupport
public String autoIncrementInsertValue(String sequenceName)
autoIncrementInsertValue
in interface IDbmsSupport
public boolean autoIncrementUsesSequenceObject()
autoIncrementUsesSequenceObject
in interface IDbmsSupport
public String getInsertedAutoIncrementValueQuery(String sequenceName)
getInsertedAutoIncrementValueQuery
in interface IDbmsSupport
public String getIbisStoreSummaryQuery()
getIbisStoreSummaryQuery
in interface IDbmsSupport
public String getTimestampFieldType()
getTimestampFieldType
in interface IDbmsSupport
public String getDatetimeLiteral(Date date)
getDatetimeLiteral
in interface IDbmsSupport
public String getTimestampAsDate(String columnName)
getTimestampAsDate
in interface IDbmsSupport
public String getClobFieldType()
getClobFieldType
in interface IDbmsSupport
public boolean isClobType(ResultSetMetaData rsmeta, int colNum) throws SQLException
isClobType
in interface IDbmsSupport
SQLException
public boolean mustInsertEmptyClobBeforeData()
mustInsertEmptyClobBeforeData
in interface IDbmsSupport
public String getUpdateClobQuery(String table, String clobField, String keyField)
getUpdateClobQuery
in interface IDbmsSupport
public String emptyClobValue()
emptyClobValue
in interface IDbmsSupport
public Object getClobHandle(ResultSet rs, int column) throws SQLException, JdbcException
getClobHandle
in interface IDbmsSupport
SQLException
JdbcException
public Object getClobHandle(ResultSet rs, String column) throws SQLException, JdbcException
getClobHandle
in interface IDbmsSupport
SQLException
JdbcException
public Writer getClobWriter(ResultSet rs, int column, Object clobHandle) throws SQLException, JdbcException
getClobWriter
in interface IDbmsSupport
SQLException
JdbcException
public Writer getClobWriter(ResultSet rs, String column, Object clobHandle) throws SQLException, JdbcException
getClobWriter
in interface IDbmsSupport
SQLException
JdbcException
public void updateClob(ResultSet rs, int column, Object clobHandle) throws SQLException, JdbcException
updateClob
in interface IDbmsSupport
SQLException
JdbcException
public void updateClob(ResultSet rs, String column, Object clobHandle) throws SQLException, JdbcException
updateClob
in interface IDbmsSupport
SQLException
JdbcException
public Object getClobHandle(PreparedStatement stmt, int column) throws SQLException, JdbcException
getClobHandle
in interface IDbmsSupport
SQLException
JdbcException
public Writer getClobWriter(PreparedStatement stmt, int column, Object clobHandle) throws SQLException, JdbcException
getClobWriter
in interface IDbmsSupport
SQLException
JdbcException
public void applyClobParameter(PreparedStatement stmt, int column, Object clobHandle) throws SQLException, JdbcException
applyClobParameter
in interface IDbmsSupport
SQLException
JdbcException
public Reader getClobReader(ResultSet rs, int column) throws SQLException, JdbcException
getClobReader
in interface IDbmsSupport
SQLException
JdbcException
public Reader getClobReader(ResultSet rs, String column) throws SQLException, JdbcException
getClobReader
in interface IDbmsSupport
SQLException
JdbcException
public String getBlobFieldType()
getBlobFieldType
in interface IDbmsSupport
public boolean isBlobType(ResultSetMetaData rsmeta, int colNum) throws SQLException
isBlobType
in interface IDbmsSupport
SQLException
public boolean mustInsertEmptyBlobBeforeData()
mustInsertEmptyBlobBeforeData
in interface IDbmsSupport
public String getUpdateBlobQuery(String table, String blobField, String keyField)
getUpdateBlobQuery
in interface IDbmsSupport
public String emptyBlobValue()
emptyBlobValue
in interface IDbmsSupport
public Object getBlobHandle(ResultSet rs, int column) throws SQLException, JdbcException
getBlobHandle
in interface IDbmsSupport
SQLException
JdbcException
public Object getBlobHandle(ResultSet rs, String column) throws SQLException, JdbcException
getBlobHandle
in interface IDbmsSupport
SQLException
JdbcException
protected OutputStream getBlobOutputStream(ResultSet rs, Object blobUpdateHandle) throws SQLException, JdbcException
SQLException
JdbcException
public OutputStream getBlobOutputStream(ResultSet rs, int column, Object blobUpdateHandle) throws SQLException, JdbcException
getBlobOutputStream
in interface IDbmsSupport
SQLException
JdbcException
public OutputStream getBlobOutputStream(ResultSet rs, String column, Object blobUpdateHandle) throws SQLException, JdbcException
getBlobOutputStream
in interface IDbmsSupport
SQLException
JdbcException
public void updateBlob(ResultSet rs, int column, Object blobUpdateHandle) throws SQLException, JdbcException
updateBlob
in interface IDbmsSupport
SQLException
JdbcException
public void updateBlob(ResultSet rs, String column, Object blobUpdateHandle) throws SQLException, JdbcException
updateBlob
in interface IDbmsSupport
SQLException
JdbcException
public Object getBlobHandle(PreparedStatement stmt, int column) throws SQLException, JdbcException
getBlobHandle
in interface IDbmsSupport
SQLException
JdbcException
public OutputStream getBlobOutputStream(PreparedStatement stmt, int column, Object blobInsertHandle) throws SQLException, JdbcException
getBlobOutputStream
in interface IDbmsSupport
SQLException
JdbcException
public void applyBlobParameter(PreparedStatement stmt, int column, Object blobInsertHandle) throws SQLException, JdbcException
applyBlobParameter
in interface IDbmsSupport
SQLException
JdbcException
public InputStream getBlobInputStream(ResultSet rs, int column) throws SQLException, JdbcException
getBlobInputStream
in interface IDbmsSupport
SQLException
JdbcException
public InputStream getBlobInputStream(ResultSet rs, String column) throws SQLException, JdbcException
getBlobInputStream
in interface IDbmsSupport
SQLException
JdbcException
public String getTextFieldType()
getTextFieldType
in interface IDbmsSupport
public String prepareQueryTextForWorkQueueReading(int batchSize, String selectQuery) throws JdbcException
prepareQueryTextForWorkQueueReading
in interface IDbmsSupport
JdbcException
public String prepareQueryTextForWorkQueueReading(int batchSize, String selectQuery, int wait) throws JdbcException
prepareQueryTextForWorkQueueReading
in interface IDbmsSupport
JdbcException
public String prepareQueryTextForWorkQueuePeeking(int batchSize, String selectQuery) throws JdbcException
prepareQueryTextForWorkQueuePeeking
in interface IDbmsSupport
JdbcException
public String prepareQueryTextForWorkQueuePeeking(int batchSize, String selectQuery, int wait) throws JdbcException
prepareQueryTextForWorkQueuePeeking
in interface IDbmsSupport
JdbcException
public String getFirstRecordQuery(String tableName) throws JdbcException
getFirstRecordQuery
in interface IDbmsSupport
JdbcException
public String prepareQueryTextForNonLockingRead(String selectQuery) throws JdbcException
IDbmsSupport
IDbmsSupport.prepareSessionForNonLockingRead(Connection)
.
Preferably, the effective isolation level is READ_COMMITTED (commited rows of other transactions may be read), but if placing locks can be avoid by an isolation level similar to READ_UNCOMMITTED, that is allowed too.
Should return the query unmodified if no special action is required.
For an example, see MsSqlServerDbmsSupport.prepareQueryTextForNonLockingRead(String)
prepareQueryTextForNonLockingRead
in interface IDbmsSupport
JdbcException
public JdbcSession prepareSessionForNonLockingRead(Connection conn) throws JdbcException
IDbmsSupport
IDbmsSupport.prepareQueryTextForNonLockingRead(String)
or by IDbmsSupport.prepareQueryTextForWorkQueuePeeking(int,String)
,
are executed, they will not be blocked by locks, and will avoid placing locks itself as much as possible.
Preferably isolation level is READ_COMMITTED (commited rows of other transactions may be read), but if placing locks can be avoid by an isolation level similar to READ_UNCOMMITTED, that is allowed too.
After the query is executed, jdbcSession.close() will be called, to return the connection to its normal state (which is expected to be REPEATABLE_READ).
Should return null if no preparation of the connection is required.
For an example, see prepareSessionForNonLockingRead(Connection)
prepareSessionForNonLockingRead
in interface IDbmsSupport
JdbcException
public String provideIndexHintAfterFirstKeyword(String tableName, String indexName)
provideIndexHintAfterFirstKeyword
in interface IDbmsSupport
public String provideFirstRowsHintAfterFirstKeyword(int rowCount)
provideFirstRowsHintAfterFirstKeyword
in interface IDbmsSupport
public String provideTrailingFirstRowsHint(int rowCount)
provideTrailingFirstRowsHint
in interface IDbmsSupport
public String getSchema(Connection conn) throws JdbcException
getSchema
in interface IDbmsSupport
JdbcException
public ResultSet getTableColumns(Connection conn, String tableName) throws JdbcException
getTableColumns
in interface IDbmsSupport
JdbcException
public ResultSet getTableColumns(Connection conn, String schemaName, String tableName) throws JdbcException
getTableColumns
in interface IDbmsSupport
JdbcException
public ResultSet getTableColumns(Connection conn, String schemaName, String tableName, String columnNamePattern) throws JdbcException
getTableColumns
in interface IDbmsSupport
JdbcException
public boolean isTablePresent(Connection conn, String tableName) throws JdbcException
isTablePresent
in interface IDbmsSupport
JdbcException
public boolean isTablePresent(Connection conn, String schemaName, String tableName) throws JdbcException
isTablePresent
in interface IDbmsSupport
JdbcException
public boolean isColumnPresent(Connection conn, String tableName, String columnName) throws JdbcException
isColumnPresent
in interface IDbmsSupport
JdbcException
public boolean isColumnPresent(Connection conn, String schemaName, String tableName, String columnName) throws JdbcException
isColumnPresent
in interface IDbmsSupport
JdbcException
public boolean hasIndexOnColumn(Connection conn, String schemaName, String tableName, String columnName) throws JdbcException
hasIndexOnColumn
in interface IDbmsSupport
JdbcException
protected boolean doHasIndexOnColumns(Connection conn, String schemaOwner, String tableName, List<String> columns, String indexTableName, String indexColumnTableName, String tableOwnerColumnName, String tableNameColumnName, String indexNameColumnName, String columnNameColumnName, String columPositionColumnName)
protected boolean doIsTablePresent(Connection conn, String tablesTable, String schemaColumn, String tableNameColumn, String schemaName, String tableName) throws JdbcException
JdbcException
protected boolean doIsColumnPresent(Connection conn, String columnsTable, String schemaColumn, String tableNameColumn, String columnNameColumn, String schemaName, String tableName, String columnName) throws JdbcException
JdbcException
public boolean isIndexPresent(Connection conn, String schemaOwner, String tableName, String indexName)
isIndexPresent
in interface IDbmsSupport
public boolean isSequencePresent(Connection conn, String schemaOwner, String tableName, String sequenceName)
isSequencePresent
in interface IDbmsSupport
public boolean hasIndexOnColumns(Connection conn, String schemaOwner, String tableName, List<String> columns) throws JdbcException
hasIndexOnColumns
in interface IDbmsSupport
JdbcException
public String getSchemaOwner(Connection conn) throws SQLException, JdbcException
getSchemaOwner
in interface IDbmsSupport
SQLException
JdbcException
public boolean isConstraintViolation(SQLException e)
isConstraintViolation
in interface IDbmsSupport
public String getRowNumber(String order, String sort)
getRowNumber
in interface IDbmsSupport
public String getRowNumberShortName()
getRowNumberShortName
in interface IDbmsSupport
public String getLength(String column)
getLength
in interface IDbmsSupport
public String getBooleanFieldType()
getBooleanFieldType
in interface IDbmsSupport
public String getBooleanValue(boolean value)
getBooleanValue
in interface IDbmsSupport
protected ISqlTranslator createTranslator(String source, String target) throws JdbcException
JdbcException
public void convertQuery(QueryExecutionContext queryExecutionContext, String sqlDialectFrom) throws SQLException, JdbcException
convertQuery
in interface IDbmsSupport
SQLException
JdbcException
protected void warnConvertQuery(String sqlDialectFrom)
protected boolean isQueryConversionRequired(String sqlDialectFrom)
public String getCleanUpIbisstoreQuery(String tableName, String keyField, String typeField, String expiryDateField, int maxRows)
getCleanUpIbisstoreQuery
in interface IDbmsSupport
Copyright © 2023 Frank!Framework. All rights reserved.