Skip to content

Commit

Permalink
JDBC-464 Expose close() method on dbmd, add entry to release notes
Browse files Browse the repository at this point in the history
  • Loading branch information
mrotteveel committed Dec 17, 2016
1 parent fb66511 commit 9227333
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
4 changes: 4 additions & 0 deletions src/documentation/release_notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,10 @@ The following has been changed or fixed since Jaybird 3.0.0-beta-1
- Changed logging of Embedded library to only log on error if none of the
libraries could be loaded.
- Fixed: native protocol is 20x-30x slower than Jaybird 2.2 native [JDBC-463](http://tracker.firebirdsql.org/browse/JDBC-463)
- Fixed: `ResultSetMetaData.getPrecision` of a numeric column when no
transaction is active throws an SQLException ([JDBC-464](http://tracker.firebirdsql.org/browse/JDBC-464))\
As part of this fix, the handling of queries executed by `FBDatabaseMetaData`
has been changed. Most metadata queries are now kept prepared for reuse.

What's new in Jaybird 3.0
=========================
Expand Down
13 changes: 8 additions & 5 deletions src/main/org/firebirdsql/jdbc/FBDatabaseMetaData.java
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,16 @@ protected FBDatabaseMetaData(FBConnection c) throws SQLException {
firebirdSupportInfo = supportInfoFor(c);
}

protected void close() {
@Override
public void close() {
try {
for (FBStatement stmt : statements.values()) {
stmt.close();
for (FBStatement stmt : new ArrayList<>(statements.values())) {
try {
stmt.close();
} catch (SQLException e) {
log.warn("error in DatabaseMetaData.close", e);
}
}
} catch (SQLException e) {
log.warn("error in DatabaseMetaData.close", e);
} finally {
statements.clear();
}
Expand Down
9 changes: 9 additions & 0 deletions src/main/org/firebirdsql/jdbc/FirebirdDatabaseMetaData.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
*
* @author <a href="mailto:[email protected]">Michael Romankiewicz</a>
*/
@SuppressWarnings("unused")
public interface FirebirdDatabaseMetaData extends DatabaseMetaData {

/**
Expand Down Expand Up @@ -105,4 +106,12 @@ public interface FirebirdDatabaseMetaData extends DatabaseMetaData {
* @see #getDatabaseDialect()
*/
int getConnectionDialect() throws SQLException;

/**
* Closes any cached metadata statements held by this database metadata implementation.
* <p>
* The database metadata object itself remains usable. Exceptions during statement close are logged and suppressed.
* </p>
*/
void close();
}

0 comments on commit 9227333

Please sign in to comment.