org.araneaframework.backend.list.helper
Class SqlStatement

java.lang.Object
  extended byorg.araneaframework.backend.list.helper.SqlStatement
All Implemented Interfaces:
Cloneable, Serializable

public class SqlStatement
extends Object
implements Serializable, Cloneable

Author:
Rein Raudjärv
See Also:
Serialized Form

Field Summary
protected  List parameters
           
protected  String query
           
 
Constructor Summary
SqlStatement()
           
SqlStatement(String query)
           
SqlStatement(String query, List parameters)
           
 
Method Summary
 void addAllParams(int index, List params)
          Adds parameters at the specified position.
 void addAllParams(List params)
          Adds parameters.
 void addNullParam(int valueType)
          Adds a NULL parameter.
 void addNullParam(int index, int valueType)
          Adds a NULL parameter at the specified position.
 void addParam(int index, Object param)
          Adds a parameter at the specified position.
 void addParam(Object param)
          Adds a parameter.
 void clearParams()
          Clears all parameters.
 Object clone()
          Constructs a new SqlStatement with the same Query and Parameters.
 int countParams()
          Counts all parameters.
 List getParams()
           
 String getQuery()
           
protected  void propagateStatementWithParams(PreparedStatement pstmt)
          Helper method that sets the parameters to the PreparedStatement.
 void setParams(List params)
           
 void setQuery(String query)
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

query

protected String query

parameters

protected List parameters
Constructor Detail

SqlStatement

public SqlStatement(String query,
                    List parameters)

SqlStatement

public SqlStatement(String query)

SqlStatement

public SqlStatement()
Method Detail

getParams

public List getParams()

setParams

public void setParams(List params)

getQuery

public String getQuery()

setQuery

public void setQuery(String query)

addParam

public void addParam(int index,
                     Object param)
Adds a parameter at the specified position.

Parameters:
index - index at witch the specified parameter will be inserted.
param - a parameter.

addNullParam

public void addNullParam(int index,
                         int valueType)
Adds a NULL parameter at the specified position.

Parameters:
index - index at witch the specified parameter will be inserted.
valueType - the type of the NULL value.

addAllParams

public void addAllParams(int index,
                         List params)
Adds parameters at the specified position.

Parameters:
index - index at witch the specified parameters will be inserted.
params - parameters.

countParams

public int countParams()
Counts all parameters.

Returns:
paramaetrs count.

addParam

public void addParam(Object param)
Adds a parameter.

Parameters:
param - a parameter.

addNullParam

public void addNullParam(int valueType)
Adds a NULL parameter.

Parameters:
valueType - the type of the NULL value.

addAllParams

public void addAllParams(List params)
Adds parameters.

Parameters:
params - parameters.

clearParams

public void clearParams()
Clears all parameters.


clone

public Object clone()
Constructs a new SqlStatement with the same Query and Parameters.

See Also:
Object.clone()

propagateStatementWithParams

protected void propagateStatementWithParams(PreparedStatement pstmt)
                                     throws SQLException
Helper method that sets the parameters to the PreparedStatement.

Parameters:
pstmt - PreparedStatement which parameters will be set.
Throws:
SQLException