org.clazzes.jdbc2xml.sql
Class SqlCommandQueue

java.lang.Object
  extended by org.clazzes.jdbc2xml.sql.SqlCommandQueue

public class SqlCommandQueue
extends Object

This is a queue of SQL commands, which may be rolled back or committed.

Author:
wglas

Constructor Summary
SqlCommandQueue()
          Default constructor.
 
Method Summary
 Enumeration<SqlCommand> commands()
           
 void commit(Connection connection)
          Perform all commands currently pushed to the stack by pushCommand(SqlCommand) and not performed yet.
 void perform(Connection connection)
          Perform all commands currently pushed to the stack by pushCommand(SqlCommand) and not performed yet.
 void pushCommand(SqlCommand command)
           
 void pushCommand(String performSql, String rollbackSql)
          Push an instance of SimpleSqlCommand to the queue.
 void rollback(Connection connection)
          Roll back all commands currently pushed to the stack by pushCommand(SqlCommand) and performed up to now.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SqlCommandQueue

public SqlCommandQueue()
Default constructor.

Method Detail

pushCommand

public void pushCommand(SqlCommand command)
Parameters:
command - The command to push to the queue.

pushCommand

public void pushCommand(String performSql,
                        String rollbackSql)
Push an instance of SimpleSqlCommand to the queue.

Parameters:
performSql - The sql statement to perform the change.
rollbackSql - The sql statement to roll back the change.
See Also:
SimpleSqlCommand.SimpleSqlCommand(String, String)

perform

public void perform(Connection connection)
             throws SQLException
Perform all commands currently pushed to the stack by pushCommand(SqlCommand) and not performed yet.

Parameters:
connection - The JDBC connection on which to perform queries.
Throws:
SQLException - Upon database errors.
See Also:
SqlCommand.perform(Connection)

commit

public void commit(Connection connection)
            throws SQLException
Perform all commands currently pushed to the stack by pushCommand(SqlCommand) and not performed yet. Afterwards discard the whole set of database commands.

Parameters:
connection - The JDBC connection on which to perform queries.
Throws:
SQLException - Upon database errors.

rollback

public void rollback(Connection connection)
              throws SQLException
Roll back all commands currently pushed to the stack by pushCommand(SqlCommand) and performed up to now. Afterwards discard the whole set of database commands.

Parameters:
connection - The JDBC connection on which to perform the rollback.
Throws:
SQLException
See Also:
SqlCommand.rollback(Connection)

commands

public Enumeration<SqlCommand> commands()


Copyright © 2011. All Rights Reserved.