Package org.eclipse.net4j.db
Interface IDBAdapter
-
- All Known Implementing Classes:
DBAdapter,DerbyAdapter,EmbeddedDerbyAdapter,H2Adapter,HSQLDBAdapter,MYSQLAdapter,PostgreSQLAdapter
public interface IDBAdapterAbstracts all aspects of a database that are vendor-specific.- Author:
- Eike Stepper
- No Implement
- This interface is not intended to be implemented by clients. Subclass
DBAdapterinstead.
-
-
Field Summary
Fields Modifier and Type Field Description static org.eclipse.net4j.util.registry.IRegistry<java.lang.String,IDBAdapter>REGISTRY
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description DBTypeadaptType(DBType type)Provide a way for the DBAdapter to override unsupported DB types with replacements.IDBConnectionProvidercreateConnectionProvider(javax.sql.DataSource dataSource)javax.sql.DataSourcecreateJDBCDataSource()Deprecated.As of 4.2 no longer supported because of IP issues for external build dependencies (the vendor driver libs).booleancreateTable(IDBTable table, java.sql.Statement statement)java.util.Set<IDBTable>createTables(java.lang.Iterable<? extends IDBTable> tables, java.sql.Connection connection)booleandropTable(IDBTable table, java.sql.Statement statement)java.util.Collection<IDBTable>dropTables(java.lang.Iterable<? extends IDBTable> tables, java.sql.Connection connection)intgetFieldLength(DBType type)Returns the column length for the given database type.java.sql.DrivergetJDBCDriver()Deprecated.As of 4.2 no longer supported because of IP issues for external build dependencies (the vendor driver libs).intgetMaxFieldNameLength()intgetMaxTableNameLength()java.lang.StringgetName()java.lang.String[]getReservedWords()java.lang.StringgetVersion()booleanisColumnNotFoundException(java.sql.SQLException ex)booleanisDuplicateKeyException(java.sql.SQLException ex)Check if an exception indicates a constraint violation (duplicate key)booleanisReservedWord(java.lang.String word)booleanisTableNotFoundException(java.sql.SQLException ex)booleanisTypeIndexable(DBType type)booleanisValidFirstChar(char ch)Check if a character is valid as first character.java.sql.ConnectionmodifyConnection(java.sql.Connection connection)IDBSchemareadSchema(java.sql.Connection connection, java.lang.String name)voidreadSchema(java.sql.Connection connection, IDBSchema schema)java.lang.StringsqlModifyField(IDBField field)java.lang.StringsqlRenameField(IDBField field, java.lang.String oldName)voidupdateSchema(java.sql.Connection connection, IDBSchema schema, IDBSchemaDelta delta)
-
-
-
Field Detail
-
REGISTRY
static final org.eclipse.net4j.util.registry.IRegistry<java.lang.String,IDBAdapter> REGISTRY
-
-
Method Detail
-
getName
java.lang.String getName()
-
getVersion
java.lang.String getVersion()
-
getJDBCDriver
@Deprecated java.sql.Driver getJDBCDriver()
Deprecated.As of 4.2 no longer supported because of IP issues for external build dependencies (the vendor driver libs).
-
createJDBCDataSource
@Deprecated javax.sql.DataSource createJDBCDataSource()
Deprecated.As of 4.2 no longer supported because of IP issues for external build dependencies (the vendor driver libs).
-
createConnectionProvider
IDBConnectionProvider createConnectionProvider(javax.sql.DataSource dataSource)
- Since:
- 4.3
-
modifyConnection
java.sql.Connection modifyConnection(java.sql.Connection connection)
- Since:
- 4.5
-
readSchema
IDBSchema readSchema(java.sql.Connection connection, java.lang.String name)
- Since:
- 4.2
-
readSchema
void readSchema(java.sql.Connection connection, IDBSchema schema)- Since:
- 4.2
-
updateSchema
void updateSchema(java.sql.Connection connection, IDBSchema schema, IDBSchemaDelta delta) throws DBException- Throws:
DBException- Since:
- 4.2
-
createTables
java.util.Set<IDBTable> createTables(java.lang.Iterable<? extends IDBTable> tables, java.sql.Connection connection) throws DBException
- Throws:
DBException
-
createTable
boolean createTable(IDBTable table, java.sql.Statement statement) throws DBException
- Throws:
DBException
-
dropTables
java.util.Collection<IDBTable> dropTables(java.lang.Iterable<? extends IDBTable> tables, java.sql.Connection connection) throws DBException
- Throws:
DBException
-
dropTable
boolean dropTable(IDBTable table, java.sql.Statement statement)
-
getReservedWords
java.lang.String[] getReservedWords()
-
isReservedWord
boolean isReservedWord(java.lang.String word)
-
getMaxTableNameLength
int getMaxTableNameLength()
- Since:
- 2.0
-
getMaxFieldNameLength
int getMaxFieldNameLength()
- Since:
- 2.0
-
getFieldLength
int getFieldLength(DBType type)
Returns the column length for the given database type.- Parameters:
type- theDBTypeto check.- Returns:
- the supported column length for the type.
- Since:
- 4.2
-
isTypeIndexable
boolean isTypeIndexable(DBType type)
-
adaptType
DBType adaptType(DBType type)
Provide 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.- Since:
- 3.0
-
isValidFirstChar
boolean isValidFirstChar(char ch)
Check if a character is valid as first character. (e.g., underscores are forbidden as first character in Derby elements.- Since:
- 4.0
-
isDuplicateKeyException
boolean isDuplicateKeyException(java.sql.SQLException ex)
Check if an exception indicates a constraint violation (duplicate key)- Since:
- 4.0
-
isTableNotFoundException
boolean isTableNotFoundException(java.sql.SQLException ex)
- Since:
- 4.2
-
isColumnNotFoundException
boolean isColumnNotFoundException(java.sql.SQLException ex)
- Since:
- 4.2
-
sqlRenameField
java.lang.String sqlRenameField(IDBField field, java.lang.String oldName)
- Since:
- 4.2
-
sqlModifyField
java.lang.String sqlModifyField(IDBField field)
- Since:
- 4.2
-
-