Class JdbcReader
java.lang.Object
org.pgcodekeeper.core.loader.jdbc.AbstractStatementReader
org.pgcodekeeper.core.loader.jdbc.JdbcReader
- Direct Known Subclasses:
ChRelationsReader,CollationsReader,ConstraintsReader,FtsConfigurationsReader,FtsDictionariesReader,FtsParsersReader,FtsTemplatesReader,FunctionsReader,IndicesReader,MsCheckConstraintsReader,MsExtendedObjectsReader,MsFKReader,MsFPVTReader,MsIndicesAndPKReader,MsSequencesReader,MsStatisticsReader,MsTablesReader,MsTypesReader,OperatorsReader,PoliciesReader,RulesReader,SequencesReader,StatisticsReader,TablesReader,TriggersReader,TypesReader,ViewsReader
Abstract base class for JDBC readers that process database objects within schemas.
Extends AbstractStatementReader to provide schema-aware processing and dependency management.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidcheckObjectValidity(Object object, DbObjType type, String name) Checks validity of database objects that may be concurrently modified.static voidcheckTypeValidity(String type) Checks type validity for concurrent modifications.static <T> T[]getColArray(ResultSet rs, String columnName) static <T> T[]getColArray(ResultSet rs, String columnName, boolean isAllowedNull) Retrieves an array column from the result set.static <T extends PgStatement>
voidsetFunctionWithDep(BiConsumer<T, String> setter, T statement, String function, String signature) Sets a function reference on a statement and adds appropriate dependencies.Methods inherited from class org.pgcodekeeper.core.loader.jdbc.AbstractStatementReader
read
-
Method Details
-
checkObjectValidity
Checks validity of database objects that may be concurrently modified. Functions that accept OID/object name and return metadata are considered unsafe as they can return null if the object was deleted outside the transaction block.- Parameters:
object- the object to check for validitytype- the database object typename- the object name- Throws:
ConcurrentModificationException- if the object is null (was deleted)
-
checkTypeValidity
Checks type validity for concurrent modifications. Validates that the type is not null or unknown (???) which can occur when functions process metadata of concurrently modified objects.- Parameters:
type- the type string to validate- Throws:
ConcurrentModificationException- if the type is invalid
-
getColArray
- Throws:
SQLException
-
getColArray
public static <T> T[] getColArray(ResultSet rs, String columnName, boolean isAllowedNull) throws SQLException Retrieves an array column from the result set. Returns the array values if present, or handles null values based on the allowed null flag.- Type Parameters:
T- the array element type- Parameters:
rs- the result set containing the datacolumnName- the name of the column containing the arrayisAllowedNull- if true, returns null when column value is null; if false, throws IllegalArgumentException when column value is null- Returns:
- the array values from the specified column, or null if the column value is null and nulls are allowed
- Throws:
SQLException- if array retrieval from the result set failsIllegalArgumentException- if the column value is null and nulls are not allowed
-
setFunctionWithDep
public static <T extends PgStatement> void setFunctionWithDep(BiConsumer<T, String> setter, T statement, String function, String signature) Sets a function reference on a statement and adds appropriate dependencies. Parses the function name to extract schema information and adds schema and function dependencies.- Type Parameters:
T- the statement type- Parameters:
setter- the setter to apply the function valuestatement- the statement to add dependencies tofunction- the function name (possibly schema-qualified)signature- the function signature, or null if not applicable
-