Class JDBCTypeConversions

  extended by org.apache.cocoon.util.JDBCTypeConversions

public class JDBCTypeConversions
extends Object

Provide some utility methods to read from JDBC result sets or store them to JDBC statements. Largely copied from org.apache.cocoon.acting.AbstractDatabaseAction.

The following table lists all available column type names together with the JDBC methods used to get or set a column with that type. In some cases the returned type differs from the type returned by the getXXX method. To set a column, a number of conversions are automatically used. For details, please see the actual code.

type getXXX returns setXXX
clob Clob String Clob
ascii Clob String asciStream
big-decimalBigDecimal BigDecimal
binary BinaryStream
blob Blob
boolean Boolean Boolean Boolean
byte Byte Byte Byte
string String String
date Date Date
double Double Double Double
float Float Float Float
int Int Integer Int
long Long Long Long
short Short Short
time Time Time
time-stamp Timestamp Timestamp
array Array Array
row Object Struct Object
object Object Object

CVS $Id: JDBCTypeConversions.html 1304258 2012-03-23 10:09:27Z ilgrosso $

Field Summary
static Map typeConstants
Constructor Summary
Method Summary
static Object convert(Object value, String jType)
          Converts an object to a JDBC type.
static Object getColumn(ResultSet set, Configuration column)
          Get the Statement column so that the results are mapped correctly.
static void setColumn(PreparedStatement statement, int position, Object value, Integer typeObject)
          Set the Statement column so that the results are mapped correctly.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail


public static final Map typeConstants
Constructor Detail


public JDBCTypeConversions()
Method Detail


public static Object convert(Object value,
                             String jType)
Converts an object to a JDBC type. This has just been started and does not do much at the moment.


public static Object getColumn(ResultSet set,
                               Configuration column)
                        throws Exception
Get the Statement column so that the results are mapped correctly. (this has been copied from AbstractDatabaseAction and modified slightly)



public static void setColumn(PreparedStatement statement,
                             int position,
                             Object value,
                             Integer typeObject)
                      throws Exception
Set the Statement column so that the results are mapped correctly.

statement - the prepared statement
position - the position of the column
value - the value of the column

Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.