Package org.eclipse.net4j.spi.db
Class DelegatingDBAdapter
java.lang.Object
org.eclipse.net4j.spi.db.DelegatingDBAdapter
- All Implemented Interfaces:
IDBAdapter,IDBAdapterID
Keeps extension metadata authoritative without requiring the created adapter to extend DBAdapter.
- Since:
- 4.14
- Author:
- Eike Stepper
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.eclipse.net4j.db.IDBAdapter
IDBAdapter.Registry -
Field Summary
Fields inherited from interface org.eclipse.net4j.db.IDBAdapter
REGISTRY -
Constructor Summary
ConstructorsConstructorDescriptionDelegatingDBAdapter(IDBAdapter delegate) DelegatingDBAdapter(IDBAdapter delegate, String name, String version) -
Method Summary
Modifier and TypeMethodDescriptionProvide a way for the DBAdapter to override unsupported DB types with replacements.voidappendFieldNames(Appendable appendable, IDBTable table) Appends the field names used by the adapter's table SQL generation.convertString(PreparedStatement preparedStatement, int parameterIndex, String value) Converts a string before it is bound to a prepared statement.convertString(ResultSet resultSet, int columnIndex, String value) Converts a string read from a result-set column.convertString(ResultSet resultSet, String columnLabel, String value) Converts a string read from a named result-set column.convertToSQL(Object value) Converts a Java value to the value used by SQL query execution.createConnectionProvider(DataSource dataSource) Deprecated.voidcreateSchema(Connection connection, String schemaName) booleancreateTable(IDBTable table, Statement statement) createTables(Iterable<? extends IDBTable> tables, Connection connection) booleandropTables(Iterable<? extends IDBTable> tables, Connection connection) booleanformat(PreparedStatement stmt) Formats a prepared statement for diagnostic output.Formats a result set for diagnostic output.getDefaultSchemaName(Connection connection) intgetFieldLength(DBType type) Returns the column length for the given database type.Deprecated.intgetJDBCTypeForNull(DBType type) Returns the JDBC type to use when binding a null value for the given database type.intintgetName()Returns the provider's adapter name.String[]String[]Returns the SQL-92 reserved words used by the adapter implementation.Returns the provider's adapter version.inthashCode()booleanbooleanbooleanCheck if an exception indicates a constraint violation (duplicate key)booleanReturns whether a duplicate-key exception aborts the current JDBC transaction and therefore requires a savepoint to recover from it.booleanisReservedWord(String word) booleanbooleanisTypeIndexable(DBType type) booleanisValidFirstChar(char ch) Check if a character is valid as first character.modifyConnection(Connection connection) openSchemaTransaction(IDBDatabase database, IDBConnection currentConnection) Opens a schema transaction through the adapter extension point.readSchema(Connection connection, String name) voidreadSchema(Connection connection, IDBSchema schema) sqlCharIndex(Object substring, Object string) sqlModifyField(IDBField field) sqlRenameField(IDBField field, String oldName) sqlSubstring(Object string, Object startIndex) sqlSubstring(Object string, Object startIndex, Object length) toString()voidupdateSchema(Connection connection, IDBSchema schema, IDBSchemaDelta delta)
-
Constructor Details
-
DelegatingDBAdapter
-
DelegatingDBAdapter
-
-
Method Details
-
getName
Description copied from interface:IDBAdapterReturns the provider's adapter name. Registry registration and lookup compare this value case-insensitively; the value returned by this method is not lowercased for the caller.- Specified by:
getNamein interfaceIDBAdapter- Specified by:
getNamein interfaceIDBAdapterID- Returns:
- the adapter name
-
getVersion
Description copied from interface:IDBAdapterReturns the provider's adapter version. Registry registration and lookup compare dot-separated numeric components and ignore trailing zero components, while the original representation returned here remains available to callers.- Specified by:
getVersionin interfaceIDBAdapter- Specified by:
getVersionin interfaceIDBAdapterID- Returns:
- the adapter version
-
hashCode
public int hashCode() -
equals
-
toString
-
createConnectionProvider
- Specified by:
createConnectionProviderin interfaceIDBAdapter
-
modifyConnection
- Specified by:
modifyConnectionin interfaceIDBAdapter
-
isCaseSensitive
public boolean isCaseSensitive()- Specified by:
isCaseSensitivein interfaceIDBAdapter
-
getDefaultSchemaName
- Specified by:
getDefaultSchemaNamein interfaceIDBAdapter
-
createSchema
- Specified by:
createSchemain interfaceIDBAdapter
-
openSchemaTransaction
public IDBSchemaTransaction openSchemaTransaction(IDBDatabase database, IDBConnection currentConnection) Description copied from interface:IDBAdapterOpens a schema transaction through the adapter extension point.- Specified by:
openSchemaTransactionin interfaceIDBAdapter
-
readSchema
- Specified by:
readSchemain interfaceIDBAdapter
-
readSchema
- Specified by:
readSchemain interfaceIDBAdapter
-
updateSchema
public void updateSchema(Connection connection, IDBSchema schema, IDBSchemaDelta delta) throws DBException - Specified by:
updateSchemain interfaceIDBAdapter- Throws:
DBException
-
createTables
public Set<IDBTable> createTables(Iterable<? extends IDBTable> tables, Connection connection) throws DBException - Specified by:
createTablesin interfaceIDBAdapter- Throws:
DBException
-
createTable
- Specified by:
createTablein interfaceIDBAdapter- Throws:
DBException
-
dropTables
public Collection<IDBTable> dropTables(Iterable<? extends IDBTable> tables, Connection connection) throws DBException - Specified by:
dropTablesin interfaceIDBAdapter- Throws:
DBException
-
dropTable
- Specified by:
dropTablein interfaceIDBAdapter
-
getReservedWords
- Specified by:
getReservedWordsin interfaceIDBAdapter
-
isReservedWord
- Specified by:
isReservedWordin interfaceIDBAdapter
-
getMaxTableNameLength
public int getMaxTableNameLength()- Specified by:
getMaxTableNameLengthin interfaceIDBAdapter
-
getMaxFieldNameLength
public int getMaxFieldNameLength()- Specified by:
getMaxFieldNameLengthin interfaceIDBAdapter
-
getFieldLength
Description copied from interface:IDBAdapterReturns the column length for the given database type.- Specified by:
getFieldLengthin interfaceIDBAdapter- Parameters:
type- theDBTypeto check.- Returns:
- the supported column length for the type.
-
isTypeIndexable
- Specified by:
isTypeIndexablein interfaceIDBAdapter
-
adaptType
Description copied from interface:IDBAdapterProvide a way for the DBAdapter to override unsupported DB types with replacements. The default implementation just returns the given type. Subclasses may override single types with replacements.- Specified by:
adaptTypein interfaceIDBAdapter
-
getJDBCTypeForNull
Description copied from interface:IDBAdapterReturns the JDBC type to use when binding a null value for the given database type.- Specified by:
getJDBCTypeForNullin interfaceIDBAdapter
-
isValidFirstChar
public boolean isValidFirstChar(char ch) Description copied from interface:IDBAdapterCheck if a character is valid as first character. (e.g., underscores are forbidden as first character in Derby elements.- Specified by:
isValidFirstCharin interfaceIDBAdapter
-
isDuplicateKeyException
Description copied from interface:IDBAdapterCheck if an exception indicates a constraint violation (duplicate key)- Specified by:
isDuplicateKeyExceptionin interfaceIDBAdapter
-
isDuplicateKeyTransactionAbort
public boolean isDuplicateKeyTransactionAbort()Description copied from interface:IDBAdapterReturns whether a duplicate-key exception aborts the current JDBC transaction and therefore requires a savepoint to recover from it.- Specified by:
isDuplicateKeyTransactionAbortin interfaceIDBAdapter
-
isTableNotFoundException
- Specified by:
isTableNotFoundExceptionin interfaceIDBAdapter
-
isColumnNotFoundException
- Specified by:
isColumnNotFoundExceptionin interfaceIDBAdapter
-
sqlRenameField
- Specified by:
sqlRenameFieldin interfaceIDBAdapter
-
sqlModifyField
- Specified by:
sqlModifyFieldin interfaceIDBAdapter
-
sqlCharIndex
- Specified by:
sqlCharIndexin interfaceIDBAdapter
-
sqlSubstring
- Specified by:
sqlSubstringin interfaceIDBAdapter
-
sqlSubstring
- Specified by:
sqlSubstringin interfaceIDBAdapter
-
sqlConcat
- Specified by:
sqlConcatin interfaceIDBAdapter
-
convertString
Description copied from interface:IDBAdapterConverts a string before it is bound to a prepared statement.- Specified by:
convertStringin interfaceIDBAdapter
-
convertString
Description copied from interface:IDBAdapterConverts a string read from a result-set column.- Specified by:
convertStringin interfaceIDBAdapter
-
convertString
Description copied from interface:IDBAdapterConverts a string read from a named result-set column.- Specified by:
convertStringin interfaceIDBAdapter
-
getSQL92ReservedWords
Description copied from interface:IDBAdapterReturns the SQL-92 reserved words used by the adapter implementation.- Specified by:
getSQL92ReservedWordsin interfaceIDBAdapter
-
appendFieldNames
Description copied from interface:IDBAdapterAppends the field names used by the adapter's table SQL generation.- Specified by:
appendFieldNamesin interfaceIDBAdapter
-
format
Description copied from interface:IDBAdapterFormats a prepared statement for diagnostic output.- Specified by:
formatin interfaceIDBAdapter
-
format
Description copied from interface:IDBAdapterFormats a result set for diagnostic output.- Specified by:
formatin interfaceIDBAdapter
-
convertToSQL
Description copied from interface:IDBAdapterConverts a Java value to the value used by SQL query execution.- Specified by:
convertToSQLin interfaceIDBAdapter
-
getJDBCDriver
Deprecated.- Specified by:
getJDBCDriverin interfaceIDBAdapter
-
createJDBCDataSource
Deprecated.- Specified by:
createJDBCDataSourcein interfaceIDBAdapter
-