Package org.pgcodekeeper.core.schema.ms
Class MsTable
java.lang.Object
org.pgcodekeeper.core.schema.PgStatement
org.pgcodekeeper.core.schema.PgStatementContainer
org.pgcodekeeper.core.schema.AbstractTable
org.pgcodekeeper.core.schema.ms.MsTable
- All Implemented Interfaces:
IHashable,IOptionContainer,IRelation,ISearchPath,ISimpleOptionContainer,IStatement,IStatementContainer
Represents a Microsoft SQL table with support for memory-optimized tables,
temporal tables, filestream data, and other Microsoft SQL specific features.
-
Field Summary
Fields inherited from class org.pgcodekeeper.core.schema.PgStatement
GOFields inherited from interface org.pgcodekeeper.core.schema.IOptionContainer
GP_OPTION_LIST -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddChild(IStatement st) Adds a child statement to this container.voidaddConstraint(AbstractConstraint constraint) Adds a constraint to this container.appendAlterSQL(PgStatement newCondition, SQLScript script) Fill script with object changes and return change typebooleancompare(PgStatement obj) This method does not account for nested child PgStatements.booleanDeep part ofPgStatement.equals(Object).voidcompareTableOptions(MsTable newTable, SQLScript script) Compares table options between this table and the new table, generating appropriate SQL scripts for change tracking and system versioning differences.voidcomputeChildrenHash(Hasher hasher) voidcomputeHash(Hasher hasher) Computes the hash of the implementing object using the provided hasher.getAlterTable(boolean only) Generates beginning of alter table statement.Gets a child statement by name and type.voidgetCreationSQL(SQLScript script) Generates the SQL statements needed to create this database object.voidgetDropSQL(SQLScript script, boolean generateExists) Generates DROP SQL for this statement.getPkeys()Gets the list of primary key constraints for memory-optimized tables.booleanChecks if this table is memory-optimized.booleanChecks if change tracking is enabled for this table.voidsetAnsiNulls(boolean ansiNulls) voidsetFileStream(String fileStream) voidsetPeriodEndCol(AbstractColumn periodEndCol) voidsetPeriodStartCol(AbstractColumn periodStartCol) voidsetSysVersioning(String sysVersioning) voidsetTablespace(String tablespace) voidsetTextImage(String textImage) voidsetTracked(Boolean isTracked) Methods inherited from class org.pgcodekeeper.core.schema.AbstractTable
addColumn, addOption, appendMoveDataSql, columnAdder, compareIgnoringColumnOrder, containsColumn, getColumn, getColumns, getConstraint, getConstraints, getOption, getOptions, getRelationColumns, getStatementType, isRecreated, shallowCopyMethods inherited from class org.pgcodekeeper.core.schema.PgStatementContainer
addIndex, addPolicy, addRule, addTrigger, getContainingSchema, getIndex, getIndexes, getPolicies, getPolicy, getRule, getRules, getTrigger, getTriggers, isClusteredMethods inherited from class org.pgcodekeeper.core.schema.PgStatement
addAllDeps, addDep, addPrivilege, appendAlterComments, appendComments, appendOwnerSQL, canDrop, canDropBeforeCreate, checkComments, clearPrivileges, deepCopy, equals, getAuthor, getBareName, getChildren, getComment, getDeps, getDescendants, getDropSQL, getLibName, getLocation, getName, getObjectState, getObjectState, getOwner, getParent, getPrivileges, getQualifiedName, getSQL, getTwin, getTypeName, hasChildren, hashCode, isLib, isOwned, isSubElement, setAuthor, setComment, setLibName, setLocation, setOwner, setParent, toStringMethods inherited from interface org.pgcodekeeper.core.schema.IOptionContainer
addOption, getOptionsMethods inherited from interface org.pgcodekeeper.core.schema.ISearchPath
getDatabase, getSchemaNameMethods inherited from interface org.pgcodekeeper.core.schema.ISimpleOptionContainer
appendOptions, compareOptionsMethods inherited from interface org.pgcodekeeper.core.schema.IStatement
getBareName, getComment, getName, getParent, getQualifiedName, getStatementType
-
Constructor Details
-
MsTable
Creates a new Microsoft SQL table with the specified name.- Parameters:
name- the table name
-
-
Method Details
-
getCreationSQL
Description copied from class:PgStatementGenerates 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 classPgStatement- Parameters:
script- the SQL script to append creation statements to
-
appendAlterSQL
Description copied from class:PgStatementFill script with object changes and return change type- Specified by:
appendAlterSQLin classPgStatement- Parameters:
newCondition- new object statescript- script to collect changes- Returns:
- object change type
-
getPkeys
Gets the list of primary key constraints for memory-optimized tables.- Returns:
- unmodifiable list of primary key constraints
-
addConstraint
Description copied from class:PgStatementContainerAdds a constraint to this container.- Overrides:
addConstraintin classAbstractTable- Parameters:
constraint- the constraint to add
-
compareTableOptions
Compares table options between this table and the new table, generating appropriate SQL scripts for change tracking and system versioning differences.- Parameters:
newTable- the new table to compare againstscript- the script to append SQL statements to
-
getAlterTable
Description copied from class:AbstractTableGenerates beginning of alter table statement.- Specified by:
getAlterTablein classAbstractTable- Parameters:
only- if true, append 'ONLY' to statement- Returns:
- alter table statement beginning in String format
-
getDropSQL
Description copied from class:PgStatementGenerates DROP SQL for this statement.- Overrides:
getDropSQLin classPgStatement- Parameters:
script- the SQL script to append the DROP statement togenerateExists- whether to include "IF EXISTS" in the DROP statement
-
setFileStream
-
setTextImage
-
setAnsiNulls
public void setAnsiNulls(boolean ansiNulls) -
isTracked
public boolean isTracked()Checks if change tracking is enabled for this table.- Returns:
- true if change tracking is enabled
-
setTracked
-
getTablespace
-
setTablespace
-
setPeriodStartCol
-
setPeriodEndCol
-
isMemoryOptimized
public boolean isMemoryOptimized()Checks if this table is memory-optimized.- Returns:
- true if the table is memory-optimized
-
setSysVersioning
-
compare
Description copied from class:PgStatementThis method does not account for nested child PgStatements. Shallow version ofPgStatement.equals(Object)- Overrides:
comparein classAbstractTable
-
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- Overrides:
computeHashin classAbstractTable- Parameters:
hasher- the hasher instance to use for hash computation
-
getDbType
- Overrides:
getDbTypein classPgStatement
-
addChild
Description copied from interface:IStatementContainerAdds a child statement to this container.- Specified by:
addChildin interfaceIStatementContainer- Overrides:
addChildin classPgStatementContainer- Parameters:
st- the child statement to add
-
getChild
Description copied from interface:IStatementContainerGets a child statement by name and type.- Specified by:
getChildin interfaceIStatementContainer- Overrides:
getChildin classPgStatementContainer- 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
-
compareChildren
Description copied from class:PgStatementDeep part ofPgStatement.equals(Object). Compares all object's child PgStatements for equality.- Overrides:
compareChildrenin classAbstractTable
-
computeChildrenHash
- Overrides:
computeChildrenHashin classAbstractTable
-