Arch4J 1.1

org.arch4j.dataaccess.common
Class BatchQuery

java.lang.Object
  |
  +--org.arch4j.dataaccess.common.BatchQuery

public class BatchQuery
extends Object

This class is used as a builder for batch query . This class does not hold on to any database connection It is simply a helper to hold on to the batch statements Use the add method to add SQL queries Create a new instance of this class and use any one of the add statements. You can add an "update" using the first add and an insert using the second. It does not matter which one is used A word of caution DO NOT USE SELECT STATMENTS IN A BATCH QUERY AS THEY ARE NOT SUPPORTED

Version:
1.0
Author:
Vibhu Srinivasan

Constructor Summary
BatchQuery()
           
 
Method Summary
 void add(BatchQuery aBatchQuery)
          Add the contents of a batch query to this one.
 void add(Query query)
          The add method can also be used as follows BatchQuery bquery = new BatchQuery(); String USERID_COLUMN = "UserId"; String USERNAME_COLUMN ="UserName"; String USER_TABLE = "User" Condition condition1 = new Condition( USERID_COLUMN, Condition.EQ, "01" ); Condition condition2 = new Condition( USERNAME_COLUMN, Condition.EQ, "Gandalf" ); condition1.and(condition2); update = new Update( USER_TABLE,condition1 ); bquery.add(update);
 void addMultipleStatements(String aScript)
          Parse a string containing multiple statements and add to the list of statements to execute.
 void addStatement(String aStatement)
          Add another string statement to the query.
 List getQueries()
          Returns the queries.
 String toString()
          Returns a String object representing this BatchQuery.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BatchQuery

public BatchQuery()
Method Detail

add

public void add(Query query)
The add method can also be used as follows BatchQuery bquery = new BatchQuery(); String USERID_COLUMN = "UserId"; String USERNAME_COLUMN ="UserName"; String USER_TABLE = "User" Condition condition1 = new Condition( USERID_COLUMN, Condition.EQ, "01" ); Condition condition2 = new Condition( USERNAME_COLUMN, Condition.EQ, "Gandalf" ); condition1.and(condition2); update = new Update( USER_TABLE,condition1 ); bquery.add(update);

Throws:
IllegalArgumentException - if a select statement is added to the batch

addMultipleStatements

public void addMultipleStatements(String aScript)
Parse a string containing multiple statements and add to the list of statements to execute.

Parameters:
aScript - A string containing multiple statements delimited by ';'

addStatement

public void addStatement(String aStatement)
Add another string statement to the query.

Parameters:
aStatement - A string repsresenting a sql statement.

add

public void add(BatchQuery aBatchQuery)
Add the contents of a batch query to this one.

Parameters:
aBatchQuery - the batch query to add contents from.

getQueries

public List getQueries()
Returns the queries.

Returns:
List of queries

toString

public String toString()
Returns a String object representing this BatchQuery.

Overrides:
toString in class Object
Returns:
A String object representing this BatchQuery.

Arch4J 1.1

Copyright © 2000-2004 SpiderLogic, a service of Wipfli Ullrich Bertelson LLP.