org.deegree.commons.tom.sql
Interface ParticleConverter<T extends TypedObjectNode>

All Known Subinterfaces:
CustomParticleConverter<T>, GeometryParticleConverter, PrimitiveParticleConverter
All Known Implementing Classes:
DefaultPrimitiveConverter, FeatureParticleConverter, MSSQLGeometryConverter, OracleGeometryConverter, OraclePrimitiveConverter, PostGISGeometryConverter

public interface ParticleConverter<T extends TypedObjectNode>

Implementations convert particles between TypedObjectNode instances and SQL argument / parameter objects in PreparedStatement / ResultSet instances.

Version:
$Revision: 31054 $, $Date: 2011-06-14 17:19:46 +0200 (Tue, 14 Jun 2011) $
Author:
Markus Schneider, last edited by: $Author: mschneider $

Method Summary
 String getSelectSnippet(String tableAlias)
          Returns an SQL fragment for SELECTing the particle value from the associated database table.
 String getSetSnippet(T particle)
          Returns a PreparedStatement fragment for setting the given particle value in an SQL statement.
 void setParticle(PreparedStatement stmt, T particle, int paramIndex)
          Converts the given particle and sets the designated SQL parameter in the given PreparedStatement.
 T toParticle(ResultSet rs, int colIndex)
          Builds a particle from the specified column of the current row of the given ResultSet.
 

Method Detail

getSelectSnippet

String getSelectSnippet(String tableAlias)
Returns an SQL fragment for SELECTing the particle value from the associated database table.

Parameters:
tableAlias - alias that's used for disambiguating the table, may be null
Returns:
SQL fragment (e.g. X1.columname), may be null

toParticle

T toParticle(ResultSet rs,
             int colIndex)
                                     throws SQLException
Builds a particle from the specified column of the current row of the given ResultSet.

Parameters:
rs - result set, never null
colIndex - index of the column in the result set
Returns:
particle, may be null
Throws:
SQLException

getSetSnippet

String getSetSnippet(T particle)
Returns a PreparedStatement fragment for setting the given particle value in an SQL statement.

The value may be set in a literal SQL fashion (e.g. '2007-08-09') or as a PreparedStatement placeholder ('?').

Parameters:
particle - particle value, can be null
Returns:
SQL fragment (e.g. ?), may be null

setParticle

void setParticle(PreparedStatement stmt,
                 T particle,
                 int paramIndex)
                 throws SQLException
Converts the given particle and sets the designated SQL parameter in the given PreparedStatement.

Parameters:
stmt - prepared statement, never null
particle - particle value, can be null
paramIndex - index of the SQL parameter in the statement
Throws:
SQLException


Copyright © 2011. All Rights Reserved.