org.clazzes.jdbc2xml.sql
Class SimpleSqlCommand

java.lang.Object
  extended by org.clazzes.jdbc2xml.sql.SimpleSqlCommand
All Implemented Interfaces:
SqlCommand

public class SimpleSqlCommand
extends java.lang.Object
implements SqlCommand

this is a simple SQL command, which performs SQL upadte queries using Statement.executeUpdate(String).

Author:
wglas

Constructor Summary
SimpleSqlCommand(java.lang.String performSql, java.lang.String rollbackSql)
           
 
Method Summary
 void cleanupOnCommit(java.sql.Connection connection)
          Cleanup resources kept by this command, if the transaction is committed.
 java.lang.String getPerformSql()
           
 java.lang.String getRollbackSql()
           
 java.lang.String getTempTableName()
           
 boolean isTempTableCreated()
           
 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

SimpleSqlCommand

public SimpleSqlCommand(java.lang.String performSql,
                        java.lang.String rollbackSql)
Parameters:
performSql - The sql statement to perform the change.
rollbackSql - The sql statement to roll back the change.
Method Detail

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.

getPerformSql

public java.lang.String getPerformSql()
Returns:
the performSql

getRollbackSql

public java.lang.String getRollbackSql()
Returns:
the rollbackSql

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

getTempTableName

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

isTempTableCreated

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


Copyright © 2010. All Rights Reserved.