Class AlterTableAlterColumn


public class AlterTableAlterColumn extends CommandWithColumns
This class represents the statements ALTER TABLE ADD, ALTER TABLE ADD IF NOT EXISTS, ALTER TABLE ALTER COLUMN, ALTER TABLE ALTER COLUMN SELECTIVITY, ALTER TABLE ALTER COLUMN SET DEFAULT, ALTER TABLE ALTER COLUMN DROP DEFAULT, ALTER TABLE ALTER COLUMN DROP EXPRESSION, ALTER TABLE ALTER COLUMN SET NULL, ALTER TABLE ALTER COLUMN DROP NULL, ALTER TABLE ALTER COLUMN SET VISIBLE, ALTER TABLE ALTER COLUMN SET INVISIBLE, ALTER TABLE DROP COLUMN
  • Field Details

    • tableName

      private String tableName
    • oldColumn

      private Column oldColumn
    • newColumn

      private Column newColumn
    • type

      private int type
    • defaultExpression

      private Expression defaultExpression
      Default or on update expression.
    • newSelectivity

      private Expression newSelectivity
    • usingExpression

      private Expression usingExpression
    • addFirst

      private boolean addFirst
    • addBefore

      private String addBefore
    • addAfter

      private String addAfter
    • ifTableExists

      private boolean ifTableExists
    • ifNotExists

      private boolean ifNotExists
    • columnsToAdd

      private ArrayList<Column> columnsToAdd
    • columnsToRemove

      private ArrayList<Column> columnsToRemove
    • booleanFlag

      private boolean booleanFlag
  • Constructor Details

    • AlterTableAlterColumn

      public AlterTableAlterColumn(SessionLocal session, Schema schema)
  • Method Details

    • setIfTableExists

      public void setIfTableExists(boolean b)
    • setTableName

      public void setTableName(String tableName)
    • setOldColumn

      public void setOldColumn(Column oldColumn)
    • setAddFirst

      public void setAddFirst()
      Add the column as the first column of the table.
    • setAddBefore

      public void setAddBefore(String before)
    • setAddAfter

      public void setAddAfter(String after)
    • update

      public long update()
      Description copied from class: Prepared
      Execute the statement.
      Overrides:
      update in class Prepared
      Returns:
      the update count
    • checkDefaultReferencesTable

      private static void checkDefaultReferencesTable(Table table, Expression defaultExpression)
    • checkClustering

      private void checkClustering(Column c)
    • convertIdentityColumn

      private void convertIdentityColumn(Table table, Column c)
    • removeSequence

      private void removeSequence(Table table, Sequence sequence)
    • copyData

      private void copyData(Table table, ArrayList<Sequence> sequences, boolean createConstraints)
    • cloneTableStructure

      private Table cloneTableStructure(Table table, Column[] columns, Database db, String tempName, ArrayList<Column> newColumns)
    • addColumn

      private static StringBuilder addColumn(Column column, StringBuilder columnNames, StringBuilder columnValues)
    • checkViews

      private void checkViews(SchemaObject sourceTable, SchemaObject newTable)
      Check that all views and other dependent objects.
    • checkViewsAreValid

      private void checkViewsAreValid(DbObject tableOrView)
      Check that a table or view is still valid.
      Parameters:
      tableOrView - the table or view to check
    • execute

      private void execute(String sql)
    • checkNullable

      private void checkNullable(Table table)
    • checkNoNullValues

      private void checkNoNullValues(Table table)
    • setType

      public void setType(int type)
    • setSelectivity

      public void setSelectivity(Expression selectivity)
    • setDefaultExpression

      public void setDefaultExpression(Expression defaultExpression)
      Set default or on update expression.
      Parameters:
      defaultExpression - default or on update expression
    • setUsingExpression

      public void setUsingExpression(Expression usingExpression)
      Set using expression.
      Parameters:
      usingExpression - using expression
    • setNewColumn

      public void setNewColumn(Column newColumn)
    • getType

      public int getType()
      Description copied from class: Prepared
      Get the command type as defined in CommandInterface
      Specified by:
      getType in class Prepared
      Returns:
      the statement type
    • setIfNotExists

      public void setIfNotExists(boolean ifNotExists)
    • addColumn

      public void addColumn(Column column)
      Description copied from class: CommandWithColumns
      Add a column to this table.
      Specified by:
      addColumn in class CommandWithColumns
      Parameters:
      column - the column to add
    • setColumnsToRemove

      public void setColumnsToRemove(ArrayList<Column> columnsToRemove)
    • setBooleanFlag

      public void setBooleanFlag(boolean booleanFlag)