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 java.lang.Object
implements SqlCommand

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

Author:
wglas

Constructor Summary
DropTableCommand(TableInfo ti)
          Construct a drop table command for RDMS engines, which support renaming of tables.
DropTableCommand(TableInfo ti, Dialect dialect, java.lang.String suffix)
          Construct a drop table command for RDMS engines, which do not support renaming of tables.
 
Method Summary
 void cleanupOnCommit(java.sql.Connection connection)
          Cleanup resources kept by this command, if the transaction is committed.
 void perform(java.sql.Connection connection)
          Perform an atomic SQL command.
 void rollback(java.sql.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(TableInfo ti,
                        Dialect dialect,
                        java.lang.String suffix)
                 throws java.sql.SQLException
Construct a drop table command for RDMS engines, which do not support renaming of tables.

Parameters:
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:
java.sql.SQLException - Upon unsupported foreign key options.
See Also:
DDLHelper.buildCreateTable(TableInfo, Dialect, String)

DropTableCommand

public DropTableCommand(TableInfo ti)
Construct a drop table command for RDMS engines, which support renaming of tables.

Parameters:
ti - The description of the table to be dropped.
Method Detail

cleanupOnCommit

public void cleanupOnCommit(java.sql.Connection connection)
                     throws java.sql.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:
java.sql.SQLException

perform

public void perform(java.sql.Connection connection)
             throws java.sql.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:
java.sql.SQLException - Upon database errors.

rollback

public void rollback(java.sql.Connection connection)
              throws java.sql.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:
java.sql.SQLException - Upon database errors or when a rollback is not supported.


Copyright © 2007. All Rights Reserved.