Skip to content

Commit 7352a8b

Browse files
committed
Fix
1 parent 4f8ec79 commit 7352a8b

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

asql-core/src/main/java/me/zort/sqllib/mapping/DefaultStatementMapping.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ public QueryResult executeQuery(StatementMappingOptions options, Method method,
7777
return ((SQLDatabaseConnection) connection).exec(node);
7878
}
7979
} finally {
80-
if (connection instanceof PooledSQLDatabaseConnection) {
80+
if (connection instanceof PooledSQLDatabaseConnection
81+
&& ((PooledSQLDatabaseConnection) connection).isPoolAssigned()) {
8182
((PooledSQLDatabaseConnection) connection).close();
8283
}
8384
}

asql-core/src/main/java/me/zort/sqllib/pool/PooledSQLDatabaseConnection.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ protected void setLastUsed(long lastUsed) {
2727
this.lastUsed = lastUsed;
2828
}
2929

30+
public boolean isPoolAssigned() {
31+
return assignedPool != null;
32+
}
33+
3034
/**
3135
* The close() method in this class checks if there is any assigned
3236
* pool (most commonly when this instance is part of a pool) and optionally

0 commit comments

Comments
 (0)