Class MsSchema
java.lang.Object
org.pgcodekeeper.core.database.base.schema.AbstractStatement
org.pgcodekeeper.core.database.ms.schema.MsAbstractStatement
org.pgcodekeeper.core.database.ms.schema.MsSchema
- All Implemented Interfaces:
ISchema,IStatement,IStatementContainer,IHashable
Represents a Microsoft SQL schema that contains database objects like tables, views, functions, and procedures.
Provides SQL generation for schema creation and management.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddChild(IStatement st) Adds a child statement to this container.voidaddFunction(MsAbstractCommonFunction function) Adds a function to this schema.voidaddSequence(MsSequence sequence) Adds a sequence to this schema.voidAdds a table to this schema.voidAdds a type to this schema.voidAdds a view to this schema.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.booleanDeep part ofAbstractStatement.equals(Object).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 a child statement by name and type.getChildrenByType(DbObjType type) get all children by typevoidgetCreationSQL(SQLScript script) Generates the SQL statements needed to create this database object.getFunction(String signature) Finds function according to specified functionsignature.Getter forfunctions.getIndexByName(String indexName) Finds an index by name across all tables and views in this schema.getRelation(String name) Gets a relation by name.Gets all relations (tables, views, sequences) in this schema.getSequence(String name) Finds sequence according to specified sequencename.getStatementContainer(String name) Gets a statement container by name.Gets a stream of all statement containers in this schema.Finds table according to specified tablename.Finds type according to specified typename.Finds view according to specified viewname.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, 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.ISchema
getStatementTypeMethods inherited from interface org.pgcodekeeper.core.database.api.schema.IStatement
addDependency, appendOwnerSQL, canDrop, canDropBeforeCreate, clearPrivileges, deepCopy, formatSql, getAuthor, getBareName, getChildren, getComment, getDatabase, getDependencies, getDescendants, getDropSQL, 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
-
MsSchema
Creates a new Microsoft SQL schema.- Parameters:
name- the schema name
-
-
Method Details
-
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
-
getRelations
Description copied from interface:ISchemaGets all relations (tables, views, sequences) in this schema.- Specified by:
getRelationsin interfaceISchema- Returns:
- a stream of relations
-
getRelation
Description copied from interface:ISchemaGets a relation by name.- Specified by:
getRelationin interfaceISchema- Parameters:
name- the relation name- Returns:
- found relation or null if no such relation has been found
-
addChild
Description copied from interface:IStatementContainerAdds a child statement to this container.- Specified by:
addChildin interfaceIStatementContainer- Parameters:
st- the child statement to add
-
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
-
fillChildrenList
- Overrides:
fillChildrenListin classAbstractStatement
-
fillDescendantsList
- Overrides:
fillDescendantsListin classAbstractStatement
-
getTable
Finds table according to specified tablename.- Parameters:
name- name of the table to be searched- Returns:
- found table or null if no such table has been found
-
getSequence
Finds sequence according to specified sequencename.- Parameters:
name- name of the sequence to be searched- Returns:
- found sequence or null if no such sequence has been found
-
getFunction
Finds function according to specified functionsignature.- Parameters:
signature- signature of the function to be searched- Returns:
- found function or null if no such function has been found
-
getType
Finds type according to specified typename.- Parameters:
name- name of the type to be searched- Returns:
- found type or null if no such type has been found
-
getView
Finds view according to specified viewname.- Parameters:
name- name of the view to be searched- Returns:
- found view or null if no such view has been found
-
getStatementContainer
Gets a statement container by name.- Specified by:
getStatementContainerin interfaceISchema- Parameters:
name- the name of the container to find- Returns:
- the statement container with the given name, or null if not found
-
addFunction
Adds a function to this schema.- Parameters:
function- the function to add
-
addSequence
Adds a sequence to this schema.- Parameters:
sequence- the sequence to add
-
addTable
Adds a table to this schema.- Parameters:
table- the table to add
-
addView
Adds a view to this schema.- Parameters:
view- the table to add
-
addType
Adds a type to this schema.- Parameters:
type- the table to add
-
getIndexByName
Finds an index by name across all tables and views in this schema.- Parameters:
indexName- the name of the index to find- Returns:
- the index with the given name, or null if not found
-
getStatementContainers
Gets a stream of all statement containers in this schema.- Returns:
- a stream of statement containers
-
getFunctions
Getter forfunctions. The list cannot be modified.- Returns:
functions
-
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
-
compareChildren
Description copied from class:AbstractStatementDeep part ofAbstractStatement.equals(Object). Compares all object's child PgStatements for equality.- Overrides:
compareChildrenin classAbstractStatement
-