Skip to content

Commit

Permalink
fix coverity reported resource leaks in CategoryTableImpl (#169)
Browse files Browse the repository at this point in the history
  • Loading branch information
elliVM authored Jan 15, 2025
1 parent e4acb3b commit 9f1d5b5
Showing 1 changed file with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,18 +115,24 @@ public void create() {
if (LOGGER.isInfoEnabled()) {
LOGGER.info("Creating temporary table <{}>", namedTable.getName());
}
ctx.dropTemporaryTableIfExists(namedTable).execute();

try (final DropTableStep dropTableStep = ctx.dropTemporaryTableIfExists(namedTable)) {
dropTableStep.execute();
}

final String sql = "create temporary table " + namedTable.getName()
+ "(id bigint auto_increment primary key, term_id bigint, type_id bigint, filter longblob, unique key "
+ namedTable.getName() + "_unique_key (term_id, type_id))";
final Query createQuery = ctx.query(sql);
createQuery.execute();
final Index typeIndex = DSL.index(DSL.name(namedTable.getName() + "_ix_type_id"));
final CreateIndexIncludeStep indexStep = ctx
.createIndex(typeIndex)
.on(namedTable, DSL.field("type_id", BIGINTUNSIGNED.nullable(false)));
LOGGER.trace("BloomFilterTempTable create index <{}>", indexStep);
indexStep.execute();

try (
final CreateIndexIncludeStep indexStep = ctx.createIndex(typeIndex).on(namedTable, DSL.field("type_id", BIGINTUNSIGNED.nullable(false)))
) {
LOGGER.trace("BloomFilterTempTable create index <{}>", indexStep);
indexStep.execute();
}
}

/**
Expand Down

0 comments on commit 9f1d5b5

Please sign in to comment.