Class DB2Features

java.lang.Object
com.softwaremining.sql.DB2Features
All Implemented Interfaces:
DbFeatures

public class DB2Features extends Object implements DbFeatures
DB2 Specific Features
  • Constructor Details

    • DB2Features

      public DB2Features()
  • Method Details

    • autoGeneratedKeySupported

      public boolean autoGeneratedKeySupported()
      DB2 Supports AutoGenreated Keys
      Specified by:
      autoGeneratedKeySupported in interface DbFeatures
      Returns:
    • generateKey

      public int generateKey(String keyName, String tableName, Connection connection) throws SQLException
      Description copied from interface: DbFeatures
      When a database does not allow autoGeneration of ID's - then the system will use this method to find the latest key - or generate it from a table, or key generator ...
      Specified by:
      generateKey in interface DbFeatures
      Parameters:
      keyName - - Column-name
      tableName - -
      connection - -
      Returns:
      Throws:
      SQLException
    • getInsertedKey

      public int getInsertedKey(Statement _statement) throws SQLException
      DB2 supports retrieving autogenerated key as IDENTITY_VAL_LOCAL()
      Specified by:
      getInsertedKey in interface DbFeatures
      Returns:
      Throws:
      SQLException
    • viewsSupported

      public boolean viewsSupported()
      Description copied from interface: DbFeatures
      Does the database support views ?
      Specified by:
      viewsSupported in interface DbFeatures
      Returns:
      See Also:
    • lockingClause

      public String lockingClause()
      Description copied from interface: DbFeatures
      SELECT xxx FROM TABLE

      FOR UPDATE

      Specified by:
      lockingClause in interface DbFeatures
      Returns:
      If the database does not support this feature then the method will throw an RunTime Exception Otherwise it will return " FOR UPDATE" .
      See Also:
    • isLockingSupported

      public boolean isLockingSupported()
      Specified by:
      isLockingSupported in interface DbFeatures
    • getTopRecordCriteria

      public String[] getTopRecordCriteria()
      Description copied from interface: DbFeatures
      for SEEK we need to first get 1st record. In order to make sure we get only 1 record (rather than millions) we can use the following in SQLSever: select [TOP 1] * from table WHERE ... MySQL : select * from table [LIMIT 1] WHERE ... ORACLE : select * from table WHERE ... [rownum = 1] DB2 : select * from table WHERE ... [FETCH FIRST ROW ONLY]
      Specified by:
      getTopRecordCriteria in interface DbFeatures
      Returns:
    • getLikeSymbol

      public String getLikeSymbol()
      '%' is used in most database as the Like-Symbol
      Specified by:
      getLikeSymbol in interface DbFeatures