org.histpop.server.db
Class PreparedSQLQuery

java.lang.Object
  extended by org.histpop.server.db.PreparedSQLQuery

public class PreparedSQLQuery
extends java.lang.Object

This class represents an executable instance of a prepared query Its purpose is to separate out binding parameters from executing a query, so that execution can be made a synchronised method.


Constructor Summary
PreparedSQLQuery(PreparedSQL psql)
           
 
Method Summary
 void bind(java.lang.Object value)
          This method binds the next parameter.
 java.util.Vector executeQuery()
          This method executes the query using the bound values
 int executeUpdate()
          This method executes the query using the bound values
 ServerObject getFirst()
          This method executes the query and returns the first object in the result set.
 void setResultType(java.lang.String type)
          This methods sets the return type of the result.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PreparedSQLQuery

public PreparedSQLQuery(PreparedSQL psql)
                 throws ServerException
Throws:
ServerException
Method Detail

setResultType

public void setResultType(java.lang.String type)
This methods sets the return type of the result. NB should really be in PreparedSQL constructor.


bind

public void bind(java.lang.Object value)
This method binds the next parameter. Parameters must be bound in the correct order!!


executeQuery

public java.util.Vector executeQuery()
                              throws ServerException
This method executes the query using the bound values

Throws:
ServerException

executeUpdate

public int executeUpdate()
                  throws ServerException
This method executes the query using the bound values

Throws:
ServerException

getFirst

public ServerObject getFirst()
                      throws ServerException
This method executes the query and returns the first object in the result set. It would normally be used when only one object would be expected in the result set, eg fetching by primary key

Throws:
ServerException