SolarMetric Kodo JDO 2.5.8 generated on January 11 2004

com.solarmetric.kodo.impl.jdbc.sql
Class SQLValue

java.lang.Object
  |
  +--com.solarmetric.kodo.impl.jdbc.sql.SQLValue
All Implemented Interfaces:
Serializable, SQLElement

public class SQLValue
extends Object
implements SQLElement

Class that represents a value in a SQL statement, that can either be included in a Statement (after translated through the DBDictionary), or bound as a parameter in a PreparedStatement. Determination of how the value will be represented is done by the execution envrionment, typically an instance of SQLExecutionManager.

Since:
2.4
See Also:
SQLBuffer, Serialized Form

Field Summary
static String PREPARED_STATEMENT_TOKEN
           
 
Constructor Summary
SQLValue(Object value, DBDictionary dict, int columnType)
          Constructor.
 
Method Summary
 int applyParameter(PreparedStatement ps, int index)
          Apply the parameters to the given PreparedStatement at the specified index, returning the number of parameters that were bound.
 String getBoundParameter()
          Returns the bound parameter for inclusion on a PreparedStatement.
 int getJDBCType()
          Return a type that JDBC can understand.
 String getUnboundParameter()
          Returns the parameter as a String suitable for embedding in a SQL Statement.
 Object getValue()
          Return the raw object value.
 String toString()
           
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PREPARED_STATEMENT_TOKEN

public static final String PREPARED_STATEMENT_TOKEN
Constructor Detail

SQLValue

public SQLValue(Object value,
                DBDictionary dict,
                int columnType)
Constructor.
Parameters:
value - the Object valueof the parameter
dict - The DBDictionary to use for translating object's into raw SQL for use in plain Statements.
columnType - The column type of the data, as defined by SQLTypes. This is only needed in order to know how to store a null in a PreparedStatement.
See Also:
Column.getType(), SQLTypes
Method Detail

getBoundParameter

public String getBoundParameter()
Description copied from interface: SQLElement
Returns the bound parameter for inclusion on a PreparedStatement. E.g., for a replaceable value, this would be "?", but for a literal it would be the raw String.
Specified by:
getBoundParameter in interface SQLElement

getUnboundParameter

public String getUnboundParameter()
Description copied from interface: SQLElement
Returns the parameter as a String suitable for embedding in a SQL Statement. This will do any disctionary-specific translation in order to return a String suitable for sending the data to the data store.
Specified by:
getUnboundParameter in interface SQLElement

getValue

public Object getValue()
Return the raw object value.

toString

public String toString()
Overrides:
toString in class Object

getJDBCType

public int getJDBCType()
Return a type that JDBC can understand.

applyParameter

public int applyParameter(PreparedStatement ps,
                          int index)
                   throws SQLException
Apply the parameters to the given PreparedStatement at the specified index, returning the number of parameters that were bound.
Specified by:
applyParameter in interface SQLElement
Following copied from interface: com.solarmetric.kodo.impl.jdbc.sql.SQLElement
Returns:
the number of parameters bound (typically one or 0)

SolarMetric Kodo JDO 2.5.8 generated on January 11 2004

Copyright 2001,2002,2003 SolarMetric, Inc. All Rights Reserved.