| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 2ef0657 commit a320f2c
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1284,16 +1284,24 @@ public Map<String, Connection> getConnectionMap() { | |||
| 1284 | 1284 | } | |
| 1285 | 1285 | ||
| 1286 | 1286 | protected Connection connection; | |
| 1287 | + @NotNull | ||
| 1288 | + public Connection getConnection(String key) throws Exception { | ||
| 1289 | + return getConnectionMap().get(key); | ||
| 1290 | + } | ||
| 1291 | + public Connection putConnection(String key, Connection connection) throws Exception { | ||
| 1292 | + return getConnectionMap().put(key, connection); | ||
| 1293 | + } | ||
| 1294 | + | ||
| 1287 | 1295 | @NotNull | |
| 1288 | 1296 | @Override | |
| 1289 | 1297 | public Connection getConnection(@NotNull SQLConfig<T, M, L> config) throws Exception { | |
| 1290 | 1298 | String connectionKey = getConnectionKey(config); | |
| 1291 | - connection = getConnectionMap().get(connectionKey); | ||
| 1299 | + connection = getConnection(connectionKey); | ||
| 1292 | 1300 | if (connection == null || connection.isClosed()) { | |
| 1293 | 1301 | Log.i(TAG, "select connection " + (connection == null ? " = null" : ("isClosed = " + connection.isClosed()))) ; | |
| 1294 | 1302 | // PostgreSQL 不允许 cross-database | |
| 1295 | 1303 | connection = DriverManager.getConnection(config.gainDBUri(), config.gainDBAccount(), config.gainDBPassword()); | |
| 1296 | - getConnectionMap().put(connectionKey, connection); | ||
| 1304 | + putConnection(connectionKey, connection); | ||
| 1297 | 1305 | } | |
| 1298 | 1306 | ||
| 1299 | 1307 | // TDengine 驱动内部事务处理方法都是空实现,手动 commit 无效 | |
| Back | FazBrowse Home | New Git URL |
0 commit comments