Class MsDatabase
java.lang.Object
org.pgcodekeeper.core.database.base.schema.AbstractStatement
org.pgcodekeeper.core.database.ms.schema.MsAbstractStatement
org.pgcodekeeper.core.database.ms.schema.MsDatabase
- All Implemented Interfaces:
IDatabase,IStatement,IStatementContainer,IHashable
Represents a Microsoft SQL database with its schemas, assemblies, roles, and users.
Provides functionality for managing database-level objects and their relationships.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAnalysisLauncher(IAnalysisLauncher launcher) Add 'analysis launcher' for deferred analyze.voidaddAssembly(MsAssembly assembly) Adds an assembly to this database.voidaddChild(IStatement st) Adds a child statement to this container.voidaddOverride(ObjectOverride override) Adds object overridevoidaddReference(String fileName, ObjectLocation loc) Adds an object reference to the specified file.voidAdds a role to this database.voidAdds a schema to this database.voidAdds a user to this database.voidClears all analysis launchers and trims the internal list to size.booleanDeep part ofAbstractStatement.equals(Object).voidcomputeChildrenHash(Hasher hasher) voidcomputeHash(Hasher hasher) Computes the hash of the implementing object using the provided hasher.voidfillChildrenList(List<Collection<? extends AbstractStatement>> l) voidfillDescendantsList(List<Collection<? extends AbstractStatement>> l) Gets all assemblies in this database.getAssembly(String name) Returns assembly of given name or null if the assembly has not been found.Gets a child statement by name and type.getChildrenByType(DbObjType type) get all children by typeGets the list of object overrides for this database.Returns role of given name or null if the role has not been found.getRoles()Gets all roles in this database.Returns schema of given name or null if the schema has not been found.Getter forschemas.getStatement(ObjectReference reference) Returns user of given name or null if the user has not been found.getUsers()Getter forusers.voidsetDefaultSchema(String defaultSchemaName) Methods inherited from class org.pgcodekeeper.core.database.ms.schema.MsAbstractStatement
appendOwnerSQL, formatSql, getQuoter, getRenameCommand, getSeparator, isOwnedMethods inherited from class org.pgcodekeeper.core.database.base.schema.AbstractStatement
addDependency, addPrivilege, appendAlterComments, appendComments, appendPrivileges, canDrop, canDropBeforeCreate, checkComments, clearPrivileges, compare, deepCopy, equals, getAuthor, getBareName, getChildren, getComment, getDependencies, getDescendants, getDropSQL, getDropSQL, getLibName, getLocation, getName, getObjectState, getObjectState, getOwner, getParent, getPrivileges, getQualifiedName, getSQL, getTwin, hasChildren, hashCode, isLib, setAuthor, setComment, setLibName, setLocation, setOwner, setParent, shallowCopy, toStringMethods inherited from interface org.pgcodekeeper.core.database.api.schema.IDatabase
addLib, appendAlterSQL, concat, containsSchema, getCreationSQL, getDatabase, getDropSQL, getStatementType, listObjectsMethods inherited from interface org.pgcodekeeper.core.database.api.schema.IStatement
addDependency, appendOwnerSQL, canDrop, canDropBeforeCreate, clearPrivileges, compare, deepCopy, formatSql, getAuthor, getBareName, getChildren, getComment, getDependencies, getDescendants, getLibName, getLocation, getName, getOwner, getParent, getPrivileges, getQualifiedName, getQuotedName, getQuoter, getRenameCommand, getSeparator, getSQL, getTwin, getTypeName, hasChildren, isLib, isOwned, quote, setComment, setLibName, setLocation, setOwner, shallowCopy, toObjectReference
-
Constructor Details
-
MsDatabase
public MsDatabase()
-
-
Method Details
-
getStatement
- Specified by:
getStatementin interfaceIDatabase- Parameters:
reference- - object reference- Returns:
- object from database by reference, or null if not found
-
clearAnalysisLaunchers
public void clearAnalysisLaunchers()Clears all analysis launchers and trims the internal list to size.- Specified by:
clearAnalysisLaunchersin interfaceIDatabase
-
fillDescendantsList
- Overrides:
fillDescendantsListin classAbstractStatement
-
fillChildrenList
- Overrides:
fillChildrenListin classAbstractStatement
-
getChild
Description copied from interface:IStatementContainerGets a child statement by name and type.- Specified by:
getChildin interfaceIStatementContainer- Parameters:
name- the name of the child to findtype- the type of the child to find- Returns:
- the child statement, or null if not found
-
getChildrenByType
Description copied from interface:IStatementContainerget all children by type- Specified by:
getChildrenByTypein interfaceIStatementContainer- Parameters:
type- the type of the children- Returns:
- unmodifiable collection of child statement, or empty list
-
addChild
Description copied from interface:IStatementContainerAdds a child statement to this container.- Specified by:
addChildin interfaceIStatementContainer- Parameters:
st- the child statement to add
-
getAssembly
Returns assembly of given name or null if the assembly has not been found.- Parameters:
name- assembly name- Returns:
- found assembly or null
-
getRole
Returns role of given name or null if the role has not been found.- Parameters:
name- role name- Returns:
- found role or null
-
getUser
Returns user of given name or null if the user has not been found.- Parameters:
name- user name- Returns:
- found user or null
-
getAssemblies
Gets all assemblies in this database.- Returns:
- unmodifiable collection of assemblies
-
getRoles
Gets all roles in this database.- Returns:
- unmodifiable collection of roles
-
getUsers
Getter forusers. The list cannot be modified.- Returns:
users
-
addAssembly
Adds an assembly to this database.- Parameters:
assembly- the assembly to add
-
addRole
Adds a role to this database.- Parameters:
role- the role to add
-
addUser
Adds a user to this database.- Parameters:
user- the user to add
-
getSchemas
Getter forschemas. The list cannot be modified.- Specified by:
getSchemasin interfaceIDatabase- Returns:
schemas
-
getVersion
- Specified by:
getVersionin interfaceIDatabase- Returns:
- default database version
-
getDefaultSchema
- Specified by:
getDefaultSchemain interfaceIDatabase
-
setDefaultSchema
- Specified by:
setDefaultSchemain interfaceIDatabase
-
addOverride
Description copied from interface:IDatabaseAdds object override- Specified by:
addOverridein interfaceIDatabase- Parameters:
override- object override
-
getOverrides
Description copied from interface:IDatabaseGets the list of object overrides for this database.- Specified by:
getOverridesin interfaceIDatabase- Returns:
- the list of overrides
-
getObjReferences
- Specified by:
getObjReferencesin interfaceIDatabase- Returns:
- all object references for this database
-
getAnalysisLaunchers
- Specified by:
getAnalysisLaunchersin interfaceIDatabase- Returns:
- all analysis launcher for this database
-
addAnalysisLauncher
Add 'analysis launcher' for deferred analyze.- Specified by:
addAnalysisLauncherin interfaceIDatabase- Parameters:
launcher- launcher that contains almost everything needed to analyze a statement contained in it
-
addReference
Description copied from interface:IDatabaseAdds an object reference to the specified file.- Specified by:
addReferencein interfaceIDatabase- Parameters:
fileName- the file name to associate with the locationloc- the object location to add
-
getSchema
Returns schema of given name or null if the schema has not been found. If schema name is null then default schema is returned. -
addSchema
Adds a schema to this database.- Parameters:
schema- the schema to add
-
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
-
computeChildrenHash
-
compareChildren
Description copied from class:AbstractStatementDeep part ofAbstractStatement.equals(Object). Compares all object's child PgStatements for equality.- Overrides:
compareChildrenin classAbstractStatement
-