@groovy.util.logging.Slf4j @groovy.transform.CompileStatic class PostgresDatabaseCleanupHelper extends java.lang.Object
Helper utility for PostgreSQL database cleanup operations. Provides PostgreSQL-specific logic such as resolving the current schema from a javax.sql.DataSource by inspecting JDBC connection metadata and parsing PostgreSQL JDBC URLs.
| Constructor and description |
|---|
PostgresDatabaseCleanupHelper() |
| Type Params | Return Type | Name and description |
|---|---|---|
|
static java.lang.String |
extractCurrentSchemaFromUrl(java.lang.String url)Extracts the current schema from a PostgreSQL JDBC URL by looking for the currentSchema parameter. |
|
static java.lang.String |
resolveCurrentSchema(javax.sql.DataSource dataSource)Resolves the current schema for the given PostgreSQL datasource by inspecting the JDBC connection metadata. |
| Methods inherited from class | Name |
|---|---|
class java.lang.Object |
java.lang.Object#equals(java.lang.Object), java.lang.Object#getClass(), java.lang.Object#hashCode(), java.lang.Object#notify(), java.lang.Object#notifyAll(), java.lang.Object#toString(), java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int) |
Extracts the current schema from a PostgreSQL JDBC URL by looking for the
currentSchema parameter. Returns null if the parameter is not set.
Examples:
jdbc:postgresql://localhost/testdb?currentSchema=myschema → myschemajdbc:postgresql://localhost/testdb → nulljdbc:postgresql://localhost/testdb?currentSchema=myschema&other=value → myschemaurl - the JDBC URLnull if not set or URL format is not recognizedResolves the current schema for the given PostgreSQL datasource by inspecting the JDBC connection metadata. If the JDBC URL contains a `currentSchema` parameter, returns that schema. Otherwise, returns the connection's current schema.
dataSource - the datasource to resolve the schema fornull if it cannot be determined