Class PgUserMapping
java.lang.Object
org.pgcodekeeper.core.database.base.schema.AbstractStatement
org.pgcodekeeper.core.database.pg.schema.PgAbstractStatement
org.pgcodekeeper.core.database.pg.schema.PgUserMapping
- All Implemented Interfaces:
IOptionContainer,IStatement,PgForeignOptionContainer,IHashable
PostgreSQL user mapping implementation.
User mappings define how to authenticate as a specific user when accessing foreign servers,
typically storing connection credentials and options for foreign data wrappers.
-
Field Summary
Fields inherited from interface org.pgcodekeeper.core.database.pg.schema.PgForeignOptionContainer
ALTER_FOREIGN_OPTION, DELIM -
Constructor Summary
ConstructorsConstructorDescriptionPgUserMapping(String user, String server) Creates a new PostgreSQL user mapping. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds an option to this container.appendAlterSQL(IStatement newCondition, SQLScript script) Fill script with object changes and return change typebooleancompare(IStatement obj) This method does not account for nested child PgStatements.voidcomputeHash(Hasher hasher) Computes the hash of the implementing object using the provided hasher.Returns the ALTER statement header for this object.voidgetCreationSQL(SQLScript script) Generates the SQL statements needed to create this database object.voidgetDropSQL(SQLScript script, boolean generateExists) Generates DROP SQL for this statement.Gets all options for this container.Gets the fully qualified name of this statement.Gets the foreign server name for this mapping.Gets the type of this database object.Methods inherited from class org.pgcodekeeper.core.database.pg.schema.PgAbstractStatement
addPrivilege, appendDefaultPrivileges, appendOwnerSQL, formatSql, getQuoter, getRenameCommand, isOwnedMethods inherited from class org.pgcodekeeper.core.database.base.schema.AbstractStatement
addDependency, appendAlterComments, appendComments, appendPrivileges, canDrop, canDropBeforeCreate, checkComments, clearPrivileges, compareChildren, deepCopy, equals, fillChildrenList, fillDescendantsList, getAuthor, getBareName, getChildren, getComment, getDependencies, getDescendants, getDropSQL, getLibName, getLocation, getName, getObjectState, getObjectState, getOwner, getParent, getPrivileges, getSeparator, getSQL, getTwin, hasChildren, hashCode, isLib, setAuthor, setComment, setLibName, setLocation, setOwner, setParent, shallowCopy, toStringMethods inherited from interface org.pgcodekeeper.core.database.api.schema.IStatement
addDependency, appendOwnerSQL, canDrop, canDropBeforeCreate, clearPrivileges, deepCopy, formatSql, getAuthor, getBareName, getChildren, getComment, getDatabase, getDependencies, getDescendants, getLibName, getLocation, getName, getOwner, getParent, getPrivileges, getQuoter, getRenameCommand, getSeparator, getSQL, getTwin, getTypeName, hasChildren, isLib, isOwned, quote, setComment, setLibName, setLocation, setOwner, shallowCopy, toObjectReferenceMethods inherited from interface org.pgcodekeeper.core.database.pg.schema.PgForeignOptionContainer
appendOptions, compareOptions
-
Constructor Details
-
PgUserMapping
Creates a new PostgreSQL user mapping.- Parameters:
user- user name for this mappingserver- foreign server name
-
-
Method Details
-
getStatementType
Description copied from interface:IStatementGets the type of this database object.- Specified by:
getStatementTypein interfaceIStatement- Returns:
- the database object type
-
getCreationSQL
Description copied from interface:IStatementGenerates the SQL statements needed to create this database object. This is an abstract method that must be implemented by subclasses to provide the specific CREATE SQL for each object type.- Specified by:
getCreationSQLin interfaceIStatement- Parameters:
script- the SQL script to append creation statements to
-
appendAlterSQL
Description copied from interface:IStatementFill script with object changes and return change type- Specified by:
appendAlterSQLin interfaceIStatement- Parameters:
newCondition- new object statescript- script to collect changes- Returns:
- object change type
-
getDropSQL
Description copied from interface:IStatementGenerates DROP SQL for this statement.- Specified by:
getDropSQLin interfaceIStatement- Overrides:
getDropSQLin classAbstractStatement- Parameters:
script- the SQL script to append the DROP statement togenerateExists- whether to include "IF EXISTS" in the DROP statement
-
getAlterHeader
Description copied from interface:PgForeignOptionContainerReturns the ALTER statement header for this object.- Specified by:
getAlterHeaderin interfacePgForeignOptionContainer- Returns:
- ALTER statement prefix (e.g., "ALTER FOREIGN TABLE table_name")
-
getServer
Gets the foreign server name for this mapping.- Returns:
- server name
-
getQualifiedName
Description copied from interface:IStatementGets the fully qualified name of this statement.- Specified by:
getQualifiedNamein interfaceIStatement- Overrides:
getQualifiedNamein classAbstractStatement- Returns:
- fully qualified (up to schema) dot-delimited object name. Identifiers are quoted.
-
addOption
Description copied from interface:IOptionContainerAdds an option to this container.- Specified by:
addOptionin interfaceIOptionContainer- Parameters:
key- the option keyvalue- the option value
-
getOptions
Description copied from interface:IOptionContainerGets all options for this container.- Specified by:
getOptionsin interfaceIOptionContainer- Returns:
- a map of option keys to values
-
getQuotedName
- Specified by:
getQuotedNamein interfaceIStatement- Returns:
- the quoted name
-
computeHash
Description copied from interface:IHashableComputes the hash of the implementing object using the provided hasher. The implementation should call appropriateputmethods on the hasher for all fields that should contribute to the hash value.- Specified by:
computeHashin interfaceIHashable- Parameters:
hasher- the hasher instance to use for hash computation
-
compare
Description copied from class:AbstractStatementThis method does not account for nested child PgStatements. Shallow version ofAbstractStatement.equals(Object)- Specified by:
comparein interfaceIStatement- Overrides:
comparein classAbstractStatement
-