org.clazzes.jdbc2xml.schema.impl
Class DropTableCommand

java.lang.Object
  extended by org.clazzes.jdbc2xml.schema.impl.DropTableCommand
All Implemented Interfaces:
SqlCommand

public class DropTableCommand
extends Object
implements SqlCommand

This class implements a rollback-enabled variant of a drop table statement.


Constructor Summary
DropTableCommand(ISchemaEngine schemaEngine, TableInfo ti, Dialect dialect, String suffix)
          Construct a drop table command for RDMS engines, which do not support renaming of tables.
DropTableCommand(ISchemaEngine schemaEngine, TableInfo ti, String renameTableCommand, Dialect dialect)
          Construct a drop table command for RDMS engines, which support renaming of tables.
 
Method Summary
 void cleanupOnCommit(Connection connection)
          Cleanup resources kept by this command, if the transaction is committed.
 String getTempTableName()
           
 boolean isTempTableCreated()
           
 void perform(Connection connection)
          Perform an atomic SQL command.
 void rollback(Connection connection)
          Roll back an atomic SQL command.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DropTableCommand

public DropTableCommand(ISchemaEngine schemaEngine,
                        TableInfo ti,
                        Dialect dialect,
                        String suffix)
                 throws SQLException
Construct a drop table command for RDMS engines, which do not support renaming of tables.

Parameters:
schemaEngine - The SchemaEngine.
ti - The description of the table to be dropped.
dialect - The dialect used to build column specs.
suffix - The RDMBS-specific create table suffix.
Throws:
SQLException - Upon unsupported foreign key options.
See Also:
DDLHelper.buildCreateTable(TableInfo, Dialect, String)

DropTableCommand

public DropTableCommand(ISchemaEngine schemaEngine,
                        TableInfo ti,
                        String renameTableCommand,
                        Dialect dialect)
Construct a drop table command for RDMS engines, which support renaming of tables.

Parameters:
schemaEngine - The SchemaEngine.
ti - The description of the table to be dropped.
renameTableCommand - A dialect specific rename table command, if the rename table operation does conform to ISO SQL. If set to null, the ISO SQL command is used. For details see DDLHelper.buildRenameTable(String, String, String).
Method Detail

cleanupOnCommit

public void cleanupOnCommit(Connection connection)
                     throws SQLException
Description copied from interface: SqlCommand
Cleanup resources kept by this command, if the transaction is committed. This might incur deleting temporary backup tables or deleting data files, which back up deleted table data.

Specified by:
cleanupOnCommit in interface SqlCommand
Throws:
SQLException

perform

public void perform(Connection connection)
             throws SQLException
Description copied from interface: SqlCommand
Perform an atomic SQL command.

Specified by:
perform in interface SqlCommand
Parameters:
connection - A JDBC connection on which to perform queries.
Throws:
SQLException - Upon database errors.

rollback

public void rollback(Connection connection)
              throws SQLException
Description copied from interface: SqlCommand
Roll back an atomic SQL command.

Specified by:
rollback in interface SqlCommand
Parameters:
connection - A JDBC connection on which to perform queries.
Throws:
SQLException - Upon database errors or when a rollback is not supported.

isTempTableCreated

public boolean isTempTableCreated()
Specified by:
isTempTableCreated in interface SqlCommand
Returns:
the tempTableCreated

getTempTableName

public String getTempTableName()
Specified by:
getTempTableName in interface SqlCommand
Returns:
the tempTableName


Copyright © 2011. All Rights Reserved.