获取连接的key增加datasource维度

This commit is contained in:
iceewei 2021-06-28 14:56:01 +08:00
parent 7b6ef60811
commit cd83f506f2
2 changed files with 3 additions and 2 deletions

0
APIJSONORM/build.sh Normal file
View File

View File

@ -732,12 +732,13 @@ public abstract class AbstractSQLExecutor implements SQLExecutor {
@NotNull
@Override
public Connection getConnection(@NotNull SQLConfig config) throws Exception {
connection = connectionMap.get(config.getDatabase());
String connectionKey = config.getDatasource() + "-" + config.getDatabase()
connection = connectionMap.get(connectionKey);
if (connection == null || connection.isClosed()) {
Log.i(TAG, "select connection " + (connection == null ? " = null" : ("isClosed = " + connection.isClosed()))) ;
// PostgreSQL 不允许 cross-database
connection = DriverManager.getConnection(config.getDBUri(), config.getDBAccount(), config.getDBPassword());
connectionMap.put(config.getDatabase(), connection);
connectionMap.put(connectionKey, connection);
}
int ti = getTransactionIsolation();