org.apache.cocoon.util
Class JDBCTypeConversions
java.lang.Object
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-decimal | BigDecimal | | 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 |
- Version:
- CVS $Id: JDBCTypeConversions.html 1304258 2012-03-23 10:09:27Z ilgrosso $
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
typeConstants
public static final Map typeConstants
JDBCTypeConversions
public JDBCTypeConversions()
convert
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.
getColumn
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)
- Throws:
Exception
setColumn
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.
- Parameters:
statement
- the prepared statementposition
- the position of the columnvalue
- the value of the column
- Throws:
Exception
Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.