Skip to content

Commit

Permalink
Corrected determination of the DB2 version for the support of BOOLEAN…
Browse files Browse the repository at this point in the history
… columns. (patch for #4723) (#4754)

* Update StandardLockService.java

Fix the error: check, that DB2Database is a superclass of the configured implementation 

Signed-off-by: Erich Haltenwanger <erich@haltenwanger.de>

* Update DB2Database.java

Fixes #4723: check of the version of DB2

Signed-off-by: Erich Haltenwanger <erich@haltenwanger.de>

* Update init method logic to only check old changelog table format logic when not using a LoggingExecutor.

---------

Signed-off-by: Erich Haltenwanger <erich@haltenwanger.de>
Co-authored-by: Daniel Mallorga <dmallorga@liquibase.com>
  • Loading branch information
haltenwe and MalloD12 committed Oct 16, 2023
1 parent d02b90b commit 4ea58c9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public boolean supportsBooleanDataType() {
throw new DatabaseException("Error getting fix pack number");

return getDatabaseMajorVersion() > 11
|| getDatabaseMajorVersion() == 11 && getDatabaseMinorVersion() >= 1 && fixPack.intValue() >= 1;
|| getDatabaseMajorVersion() == 11 && ( getDatabaseMinorVersion() == 1 && fixPack.intValue() >= 1 || getDatabaseMinorVersion() > 1 );

} catch (final DatabaseException e) {
return false; // assume not
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,9 @@ public void init() throws DatabaseException {
database.commit();
}

handleOldChangelogTableFormat(executor);
if(!(executor instanceof LoggingExecutor)) {
handleOldChangelogTableFormat(executor);
}
break;
} catch (Exception e) {
if (i == maxIterations - 1) {
Expand All @@ -163,7 +165,7 @@ public void init() throws DatabaseException {

private void handleOldChangelogTableFormat(Executor executor) throws DatabaseException {
if (executor.updatesDatabase() && (database instanceof DerbyDatabase) && ((DerbyDatabase) database)
.supportsBooleanDataType() || database.getClass().isAssignableFrom(DB2Database.class) && ((DB2Database) database)
.supportsBooleanDataType() || DB2Database.class.isAssignableFrom( database.getClass() ) && ((DB2Database) database)
.supportsBooleanDataType()) {
//check if the changelog table is of an old smallint vs. boolean format
String lockTable = database.escapeTableName(
Expand Down

0 comments on commit 4ea58c9

Please sign in to comment.