Close a portal or prepared statement From PostgreSQL ExtendedQuery protocol spec: The Close message closes an existing prepared statement or portal and releases resources. It is not an error to issue Close against a nonexistent statement or portal name. [..] Note t
(byte type, String name)
| 977 | * @param name name of the prepared statement or the portal (depending on type) |
| 978 | */ |
| 979 | public void close(byte type, String name) { |
| 980 | if (LOGGER.isDebugEnabled()) { |
| 981 | LOGGER.debug("method=close type={} name={}", (char) type, name); |
| 982 | } |
| 983 | |
| 984 | switch (type) { |
| 985 | case 'P': { |
| 986 | Portal portal = portals.remove(name); |
| 987 | if (portal != null) { |
| 988 | portal.closeActiveConsumer(); |
| 989 | } |
| 990 | return; |
| 991 | } |
| 992 | case 'S': { |
| 993 | PreparedStmt preparedStmt = preparedStatements.remove(name); |
| 994 | if (preparedStmt != null) { |
| 995 | Iterator<Map.Entry<String, Portal>> it = portals.entrySet().iterator(); |
| 996 | while (it.hasNext()) { |
| 997 | var entry = it.next(); |
| 998 | var portal = entry.getValue(); |
| 999 | if (portal.preparedStmt().equals(preparedStmt)) { |
| 1000 | portal.closeActiveConsumer(); |
| 1001 | it.remove(); |
| 1002 | } |
| 1003 | } |
| 1004 | } |
| 1005 | return; |
| 1006 | } |
| 1007 | default: |
| 1008 | throw new IllegalArgumentException("Invalid type: " + type + ", valid types are: [P, S]"); |
| 1009 | } |
| 1010 | } |
| 1011 | |
| 1012 | @Override |
| 1013 | public void close() { |