Package com.softwaremining.sql
Class DB2Features
java.lang.Object
com.softwaremining.sql.DB2Features
- All Implemented Interfaces:
DbFeatures
DB2 Specific Features
-
Field Summary
Fields inherited from interface com.softwaremining.sql.DbFeatures
ERROR_CODE__INVALID_DATE_FORMAT, LIKE_SYMBOL
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
DB2 Supports AutoGenreated Keysint
generateKey
(String keyName, String tableName, Connection connection) 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 ...int
getInsertedKey
(Statement _statement) DB2 supports retrieving autogenerated key as IDENTITY_VAL_LOCAL()'%' is used in most database as the Like-SymbolString[]
for SEEK we need to first get 1st record.boolean
SELECT xxx FROM TABLEboolean
Does the database support views ?
-
Constructor Details
-
DB2Features
public DB2Features()
-
-
Method Details
-
autoGeneratedKeySupported
public boolean autoGeneratedKeySupported()DB2 Supports AutoGenreated Keys- Specified by:
autoGeneratedKeySupported
in interfaceDbFeatures
- Returns:
-
generateKey
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 interfaceDbFeatures
- Parameters:
keyName
- - Column-nametableName
- -connection
- -- Returns:
- Throws:
SQLException
-
getInsertedKey
DB2 supports retrieving autogenerated key as IDENTITY_VAL_LOCAL()- Specified by:
getInsertedKey
in interfaceDbFeatures
- Returns:
- Throws:
SQLException
-
viewsSupported
public boolean viewsSupported()Description copied from interface:DbFeatures
Does the database support views ?- Specified by:
viewsSupported
in interfaceDbFeatures
- Returns:
- See Also:
-
lockingClause
Description copied from interface:DbFeatures
SELECT xxx FROM TABLEFOR UPDATE
- Specified by:
lockingClause
in interfaceDbFeatures
- 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 interfaceDbFeatures
-
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 interfaceDbFeatures
- Returns:
-
getLikeSymbol
'%' is used in most database as the Like-Symbol- Specified by:
getLikeSymbol
in interfaceDbFeatures
-