Clover Coverage Report - Liquibase Core 2.0.3-SNAPSHOT
Coverage timestamp: Sat Aug 6 2011 11:33:15 EDT
../../../img/srcFileCovDistChart0.png 69% of files have more coverage
11   54   6   2.2
2   43   0.55   5
5     1.2  
1    
 
  DB2DatabaseSnapshotGenerator       Line # 12 11 0% 6 18 0% 0.0
 
No Tests
 
1    package liquibase.snapshot.jvm;
2   
3    import liquibase.database.Database;
4    import liquibase.database.core.DB2Database;
5    import liquibase.exception.DatabaseException;
6    import liquibase.executor.ExecutorService;
7    import liquibase.statement.core.RawSqlStatement;
8   
9    import java.util.List;
10    import java.util.Map;
11   
 
12    public class DB2DatabaseSnapshotGenerator extends JdbcDatabaseSnapshotGenerator {
 
13  0 toggle public boolean supports(Database database) {
14  0 return database instanceof DB2Database;
15    }
16   
 
17  0 toggle public int getPriority(Database database) {
18  0 return PRIORITY_DATABASE;
19    }
20   
 
21  0 toggle @Override
22    protected String convertTableNameToDatabaseTableName(String tableName) {
23  0 return tableName.toUpperCase();
24    }
25   
 
26  0 toggle @Override
27    protected String convertColumnNameToDatabaseTableName(String columnName) {
28  0 return columnName.toUpperCase();
29    }
30   
 
31  0 toggle @Override
32    public boolean isColumnAutoIncrement(Database database, String schemaName, String tableName, String columnName)
33    throws DatabaseException {
34  0 boolean autoIncrement = false;
35   
36  0 List<Map> rs = ExecutorService
37    .getInstance()
38    .getExecutor(database)
39    .queryForList(
40    new RawSqlStatement("SELECT IDENTITY FROM SYSCAT.COLUMNS WHERE TABSCHEMA = '"
41    + database.convertRequestedSchemaToSchema(schemaName) + "' AND TABNAME = '" + tableName
42    + "' AND COLNAME = '" + columnName + "' AND HIDDEN != 'S'"));
43   
44  0 for (Map row : rs) {
45  0 String identity = row.get("IDENTITY").toString();
46  0 if (identity.equalsIgnoreCase("Y")) {
47  0 autoIncrement = true;
48    }
49    }
50   
51  0 return autoIncrement;
52    }
53   
54    }