DODS 7.2 API

com.lutris.appserver.server.sql.standard
Class StandardDBQuery

java.lang.Object
  extended by com.lutris.appserver.server.sql.standard.StandardDBQuery
All Implemented Interfaces:
DBQuery
Direct Known Subclasses:
InformixDBQuery, OracleDBQuery

public class StandardDBQuery
extends java.lang.Object
implements DBQuery

Standard implementation of a DBQuery object.

Since:
LBS1.7
Version:
$Revision: 1.3 $
Author:
Kyle Clark
See Also:
DBQuery

Constructor Summary
protected StandardDBQuery(DBConnection dbConnection)
          Construct a query object for use on the supplied dB connection.
 
Method Summary
protected  void finalize()
          Finalizer.
 boolean handleException(java.sql.SQLException e)
          Exception handler.
protected  void logDebug(java.lang.String str)
          Logging.
 java.lang.Object next()
          Returns a new object representing the next result form the query.
 void query(Query q)
          Query the database.
 void release()
          Frees all resources consumed by this query.
protected  void setReleaseConnection(boolean rc)
           
 void validate()
          Method to ensure this object is still valid.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StandardDBQuery

protected StandardDBQuery(DBConnection dbConnection)
                   throws java.sql.SQLException
Construct a query object for use on the supplied dB connection.

Parameters:
dbConnection - The database connection to use.
Throws:
java.sql.SQLException - If a database access error occurs.
Method Detail

query

public void query(Query q)
           throws java.sql.SQLException
Query the database.

Specified by:
query in interface DBQuery
Parameters:
q - Query interface via which the query will be executed.
Throws:
java.sql.SQLException - If a database access error occurs.

next

public java.lang.Object next()
                      throws java.sql.SQLException,
                             ObjectIdException
Returns a new object representing the next result form the query.

Specified by:
next in interface DBQuery
Returns:
New instance of object representing query results. null is returned when there are no more results.
Throws:
java.sql.SQLException - If a database access error occurs.
ObjectIdException - If ObjectId was not found.

release

public void release()
Frees all resources consumed by this query. Connections are returned to the connection pool. Subsequent queries via this object, will throw an exception.

Specified by:
release in interface DBQuery

handleException

public boolean handleException(java.sql.SQLException e)
Exception handler. This object is should not be used for subsequent queries if this method returns false.

Specified by:
handleException in interface DBQuery
Returns:
True if the exception can be handled and the object is still valid, false otherwise.

validate

public void validate()
              throws java.sql.SQLException
Method to ensure this object is still valid. Once this object has been released it cannot be used any more.

Specified by:
validate in interface DBQuery
Throws:
java.sql.SQLException - If a database access error occurs.

finalize

protected void finalize()
Finalizer. If this object has not been released, this method ensures that garbage collection does so.

Overrides:
finalize in class java.lang.Object

logDebug

protected void logDebug(java.lang.String str)
Logging. For debuging only, since it effects all Query objects.

Parameters:
str - The data to log.

setReleaseConnection

protected void setReleaseConnection(boolean rc)

DODS 7.2 API