Class DropTableCommand


  • public class DropTableCommand
    extends Command
    This Command class represents the DROP TABLE SQL command.
    • Nested Class Summary

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private boolean ifExists
      This flag controls whether the drop-table command will fail if the table already doesn't exist when the removal is attempted.
      private static org.apache.logging.log4j.Logger logger
      A logging object for reporting anything interesting that happens.
      private java.lang.String tableName
      The name of the table to drop from the database.
      • Fields inherited from class edu.caltech.nanodb.commands.Command

        out
    • Constructor Summary

      Constructors 
      Constructor Description
      DropTableCommand​(java.lang.String tableName, boolean ifExists)
      Construct a drop-table command for the named table.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void execute​(NanoDBServer server)
      This method executes the DROP TABLE command by calling the TableManager.dropTable(java.lang.String) method with the specified table name.
      boolean getIfExists()
      Returns the value of the "if exists" flag; true indicates that it is not an error if the table doesn't exist when this command is issued.
      java.lang.String getTableName()
      Get the name of the table to be dropped.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • logger

        private static org.apache.logging.log4j.Logger logger
        A logging object for reporting anything interesting that happens.
      • tableName

        private java.lang.String tableName
        The name of the table to drop from the database.
      • ifExists

        private boolean ifExists
        This flag controls whether the drop-table command will fail if the table already doesn't exist when the removal is attempted.
    • Constructor Detail

      • DropTableCommand

        public DropTableCommand​(java.lang.String tableName,
                                boolean ifExists)
        Construct a drop-table command for the named table.
        Parameters:
        tableName - the name of the table to drop.
        ifExists - a flag controlling whether the command should complain if the table already doesn't exist when the removal is attempted.
    • Method Detail

      • getTableName

        public java.lang.String getTableName()
        Get the name of the table to be dropped.
        Returns:
        the name of the table to drop
      • getIfExists

        public boolean getIfExists()
        Returns the value of the "if exists" flag; true indicates that it is not an error if the table doesn't exist when this command is issued.
        Returns:
        the value of the "if exists" flag
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object