org.eclipse.net4j.db
Interface IDBAdapter

All Known Implementing Classes:
org.eclipse.net4j.spi.db.DBAdapter, DerbyAdapter, EmbeddedDerbyAdapter, H2Adapter, HSQLDBAdapter, MYSQLAdapter, PostgreSQLAdapter

public interface IDBAdapter

Abstracts all aspects of a database that are vendor-specific.


Field Summary
static IRegistry<String,IDBAdapter> REGISTRY
           
 
Method Summary
 DBType adaptType(DBType type)
          Provide a way for the DBAdapter to override unsupported DB types with replacements.
 DataSource createJDBCDataSource()
           
 boolean createTable(IDBTable table, Statement statement)
           
 Set<IDBTable> createTables(Iterable<? extends IDBTable> tables, Connection connection)
           
 boolean dropTable(IDBTable table, Statement statement)
           
 Collection<IDBTable> dropTables(Iterable<? extends IDBTable> tables, Connection connection)
           
 Driver getJDBCDriver()
           
 int getMaxFieldNameLength()
           
 int getMaxTableNameLength()
           
 String getName()
           
 String[] getReservedWords()
           
 String getVersion()
           
 boolean isDuplicateKeyException(SQLException ex)
          Check if an exception indicates a constraint violation (duplicate key)
 boolean isReservedWord(String word)
           
 boolean isTypeIndexable(DBType type)
           
 boolean isValidFirstChar(char ch)
          Check if a character is valid as first character.
 

Field Detail

REGISTRY

static final IRegistry<String,IDBAdapter> REGISTRY
Method Detail

getName

String getName()

getVersion

String getVersion()

getJDBCDriver

Driver getJDBCDriver()

createJDBCDataSource

DataSource createJDBCDataSource()

createTables

Set<IDBTable> createTables(Iterable<? extends IDBTable> tables,
                           Connection connection)
                           throws DBException
Throws:
DBException

createTable

boolean createTable(IDBTable table,
                    Statement statement)
                    throws DBException
Throws:
DBException

dropTables

Collection<IDBTable> dropTables(Iterable<? extends IDBTable> tables,
                                Connection connection)
                                throws DBException
Throws:
DBException

dropTable

boolean dropTable(IDBTable table,
                  Statement statement)

getReservedWords

String[] getReservedWords()

isReservedWord

boolean isReservedWord(String word)

getMaxTableNameLength

int getMaxTableNameLength()
Since:
2.0

getMaxFieldNameLength

int getMaxFieldNameLength()
Since:
2.0

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(SQLException ex)
Check if an exception indicates a constraint violation (duplicate key)

Since:
4.0


Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.