Class WriteSchemaSqlToFileCommand


public class WriteSchemaSqlToFileCommand extends DatabaseCommandWithCreationParameters
Parses the schema XML files specified in the enclosing task, and writes the SQL statements necessary to create this schema in the database, to a file. Note that this SQL is database specific and hence this subtask requires that for the enclosing task, either a data source is specified (via the database sub element) or the databaseType attribute is used to specify the database type.
Version:
$Revision: 289996 $
  • Constructor Details

    • WriteSchemaSqlToFileCommand

      public WriteSchemaSqlToFileCommand()
  • Method Details

    • setOutputFile

      public void setOutputFile(File outputFile)
      Specifies the name of the file to write the SQL commands to.
      Parameters:
      outputFile - The output file
    • isAlterDatabase

      protected boolean isAlterDatabase()
      Determines whether to alter the database if it already exists, or re-set it.
      Returns:
      true if to alter the database
    • setAlterDatabase

      public void setAlterDatabase(boolean alterTheDb)
      Specifies whether DdlUtils shall generate SQL to alter an existing database rather than SQL for clearing it and creating it new.
      Parameters:
      alterTheDb - true if SQL to alter the database shall be created
    • isDoDrops

      protected boolean isDoDrops()
      Determines whether SQL is generated to drop tables and the associated constraints if necessary.
      Returns:
      true if drops SQL shall be generated if necessary
    • setDoDrops

      public void setDoDrops(boolean doDrops)
      Specifies whether SQL for dropping tables, external constraints, etc. is created if necessary. Note that this is only relevant when alterDatabase is false.
      Parameters:
      doDrops - true if drops shall be performed if necessary
    • execute

      public void execute(DatabaseTaskBase task, Database model) throws org.apache.tools.ant.BuildException
      Executes this command.
      Specified by:
      execute in class Command
      Parameters:
      task - The executing task
      model - The database model
      Throws:
      org.apache.tools.ant.BuildException