Skip to content

Commit

Permalink
added support for generateChangelog on DB2iSeries
Browse files Browse the repository at this point in the history
  • Loading branch information
thomseno committed Aug 5, 2013
1 parent eb78725 commit eb5b24e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
Expand Up @@ -70,7 +70,9 @@ protected DatabaseObject snapshotObject(DatabaseObject example, DatabaseSnapshot
}

protected String getSelectSequenceSql(Schema schema, Database database) {
if (database instanceof DB2Database) {
if (database instanceof DB2iDatabase) {
return "SELECT SEQUENCE_NAME FROM QSYS2.SYSSEQUENCES WHERE SEQUENCE_SCHEMA = '" + schema.getCatalogName() + "'";
} else if (database instanceof DB2Database) {
return "SELECT SEQNAME AS SEQUENCE_NAME FROM SYSCAT.SEQUENCES WHERE SEQTYPE='S' AND SEQSCHEMA = '" + schema.getCatalogName() + "'";
} else if (database instanceof DerbyDatabase) {
return "SELECT " +
Expand Down
Expand Up @@ -92,6 +92,11 @@ protected List<Map> listConstraints(Table table, Database database, Schema schem
"and uc.owner = '" + database.correctObjectName(schema.getCatalogName(), Catalog.class) + "' " +
"and ui.table_owner = '" + database.correctObjectName(schema.getCatalogName(), Catalog.class) + "' " +
"and ucc.owner = '" + database.correctObjectName(schema.getCatalogName(), Catalog.class) + "'";
} else if (database instanceof DB2iDatabase) {
sql = "select distinct CONSTRAINT_NAME from QSYS2.SYSCST " +
"where TABLE_NAME = '" + database.correctObjectName(table.getName(), Table.class) + "' " +
"and TABLE_SCHEMA = '" + database.correctObjectName(schema.getCatalogName(), Catalog.class) + "' " +
"and CONSTRAINT_TYPE = 'UNIQUE'";
} else if (database instanceof DB2Database) {
sql = "select distinct k.constname as constraint_name from syscat.keycoluse k, syscat.tabconst t " +
"where k.constname = t.constname " +
Expand Down Expand Up @@ -152,6 +157,12 @@ protected List<Map> listColumns(UniqueConstraint example, Database database) thr
"order by TC.Constraint_Name";
} else if (database instanceof OracleDatabase) {
sql = "select ucc.column_name from all_cons_columns ucc where ucc.constraint_name='"+database.correctObjectName(name, UniqueConstraint.class)+"' and ucc.owner='"+database.correctObjectName(schema.getCatalogName(), Catalog.class)+"' order by ucc.position";
} else if (database instanceof DB2iDatabase) {
sql = "select k.colname as column_name from QSYS2.SYSKEYCST k, QSYS2.SYSCST t " +
"where k.CONSTRAINT_NAME = t.CONSTRAINT_NAME " +
"and t.CONSTRAINT_TYPE = 'UNIQUE'" +
"and k.CONSTRAINT_NAME='"+database.correctObjectName(name, UniqueConstraint.class)+"' "+
"order by k.ORDINAL_POSITION";
} else if (database instanceof DB2Database) {
sql = "select k.colname as column_name from syscat.keycoluse k, syscat.tabconst t " +
"where k.constname = t.constname " +
Expand Down

0 comments on commit eb5b24e

Please sign in to comment.